to write set of values to a file from python

Dennis Benzinger Dennis.Benzinger at gmx.net
Wed Dec 14 14:28:30 EST 2005


muttu2244 at yahoo.com schrieb:
> hi everybody
> 
> i want to write a set of values to a file from python.
> For ex:: the fields name will "comp name", "ip addr", "mac addr" etc.
> And below all these fields i ll have the values for these fields.
> 
> it should look some what like this.
> 
> comp name                     ipaddr                     macaddr
> 
> jdasfhjashd                       234.347.23.12
> 334.12.354.43.232
> dfdsfusdaufisa                   234.533.45.12        89.234.234.2343
> sfdidsfoui                          234.45.23.56
> 89.343.23.45.233
> 
> something like thiss.
> 
> so which is the best way to do this.
> I mean which file format would be the best to choose , to dump all
> these values from my python script.
> 
> Will it  be a ".ini" file format? or ".xls" or ".txt" which will be the
> better one.
> so that later it will be easy for me to read this file.
> 
> thanks in advance for the help
> 
> regards
> yogi
> 


I would use a comma separated values (CSV) file.
Have a look at the csv module 
<http://www.python.org/doc/2.4.2/lib/module-csv.html>.

Bye,
Dennis



More information about the Python-list mailing list