Friends,

I am new to python and did search on the web on how to achieve this:
( I am trying to append the line numbers to all the lines of a file for now)

Thanks!!

=================================================
import os, sys

fileName = os.path.join("C:", "temp", "x1.txt")
fileobject = open(fileName, 'r')
outputDir = "C://temp//"
linenumber = 0
fileName1 = outputDir + "x2.txt"
fileobject1 = open(fileName1, 'w')
while (1):
   L = fileobject.readline()
   if L=="":
       print "**Done"
       break
   linenumber += 1
   fileobject1.write(ln)
   fileobject1.write(":: "+ L)

fileobject1.close()
=============================================================

--
Regards,
Prem
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to