Sun Jul 22, 2012 2:39 pm
import csv
mycsv_reader = csv.reader(open("codemiles.csv", "rb"))
for dataSample in mycsv_reader:
print dataSample
import csv
## get the reader object, and specify no quoting
mycsv_reader = csv.reader(open("codemiles.txt", "rb"), delimiter=':', quoting=csv.QUOTE_NONE)
for dataSample in mycsv_reader:
print dataSample
import csv
## get writer object
mycsv_writer = csv.writer(open('codemiles.csv', 'wb'), quoting=csv.QUOTE_MINIMAL)
## write rows to CVS file
mycsv_writer.writerow(['Cairo','CA'])
mycsv_writer.writerow(['Newyork','NY'])
csv_writer.writerow([Poor, saeed','PS])
Cairo, CA
Newyork , NY
“Poor, saeed”, PS
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com
Powered by phpBB © phpBB Group.