how to modify the csv file

M

muttu2244

hi everybody
am trying to modify a particular string from a csv file.

for ex

say i have

compName, ipAddr, MacAddr, Os

sdfsdf , 129.122.12.34 , dsfiasdf, wsfdjhs
hsdfdf , 123.234.34.34, dsfiasdfds, wewr

etc

now if i got to modify one particular line from these three rows , how
can i do that.

thanks in advance
yogi
 
S

skip

yogi> now if i got to modify one particular line from these three rows,
yogi> how can i do that.

Check out the csv module.

Skip
 
M

muttu2244

hi skip
i really tried with csv module, but i dint get anything, could u plase
tell me the method to modify a particular row, or atleast let me know
how can i delete a row in a csv file.

thanks
yogi
 
F

Fredrik Lundh

i really tried with csv module, but i dint get anything,
http://www.catb.org/~esr/faqs/smart-questions.html#beprecise

could u plase tell me the method to modify a particular row, or
atleast let me know how can i delete a row in a csv file.

the same way as you'd modify or delete a row in any other text
file: by reading the entire file, modifying the data, and writing it
out again.

you can either do this line by line (reading from one file and writing
to another, modifying the data on the way), or in "bulk" (load every-
thing into memory, modify the data structure, and write it out again).

</F>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top