to write set of values to a file from python

muttu2244 at yahoo.com muttu2244 at yahoo.com
Wed Dec 14 17:16:22 EST 2005


I have tried with the following code

import csv
file = open("some.csv","wb")
writer = csv.writer(file)
list = ["CompName", "IpAddr", "MacAddr","OpSys"]
for row in list:
    writer.writerow(row)

file.close()

And the result am getting in a "some.csv" file is as below

c   o   m  p  N  a  m  e
I    p   A  d  d  r
M  a   c  A  d  d  r
O  p   S  y   s

each charatecr its printing in a different cell of excel sheet(some.csv
file).
so can i print the whole strings like "compName" "ipAddr" etc in  a
different cells(columns)

thanks and regards
yogi




More information about the Python-list mailing list