i have a code in python to search and replace what i need though is to replace the first say 10 instances of the number 1 with 2 and the second 10 instances with the number 3. anybody knows how to do that?
fin = open(r'F:\1\xxx .txt')
fout = open(r'F:\1\xxx 2.txt', "wt")
for line in fin:
fout.write( line.replace('1 ', '2') )
fin.close()
fout.close()
fin = open(r'F:\1\xxx .txt')
fout = open(r'F:\1\xxx 2.txt', "wt")
for line in fin:
fout.write( line.replace('1 ', '2') )
fin.close()
fout.close()
Comment