to write set of values to a file from python

muttu2244 at yahoo.com muttu2244 at yahoo.com
Thu Dec 15 16:37:19 EST 2005


hi
thanks every body for the help.

Now how can check whtr the row am reading is the last row or not??

for example for this below data in csv file

CompName,IpAddr,MacAddr
 XXX,192.178.23.11,78.23.34.23.12
 YYY,192.189.22.11,89.23.43.12.34
 ZZZ,192.179.24.45,89.23.34.12.45

file = open ('C:\some.csv','r')
reader = csv.reader(file)
for row in reader:
      print row
      HERE HOW CAN I CHECK WHTR THIS ROW IS THE LAST ONE IN THE FILE

so that if at all i dint find what am searching for i can write that
information at the last row, after opening the file in a "append" mode.

thanks again for help

regards
yogi




More information about the Python-list mailing list