Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Merging Cells

DZone's Guide to

Merging Cells

·
Free Resource
// This code reads a CSV file, takes two fields and merges them, then writes the merged field to a text file.


import csv
import os

os.chdir('Desktop')
cwd = os.getcwd()

reader = csv.reader(open('september crime data.csv', 'r'), dialect='excel')
open_file = open('streets.txt', 'w')

for row in reader:
    street_number = row[9]
    street_name = row[3]

    open_file.write(street_number + ' ' + street_name + '\n')
    

open_file.close()

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}