i want to increment only one number in a file
instead of that i am getting only string is displaying but not the number kindly help me in this
[with open('d:/test.txt', 'r') as file:
data = file.readlines( )
print (data)
print ("Your name: " + data[2])
count=0
data[2] ="routing context count"
while count < 2:
count+=1
print(data[2])
with open('d:/test.txt', 'w') as file:
file.write('%d' % count)
file.writelines ( data )
][/CODE]
instead of that i am getting only string is displaying but not the number kindly help me in this
[with open('d:/test.txt', 'r') as file:
data = file.readlines( )
print (data)
print ("Your name: " + data[2])
count=0
data[2] ="routing context count"
while count < 2:
count+=1
print(data[2])
with open('d:/test.txt', 'w') as file:
file.write('%d' % count)
file.writelines ( data )
][/CODE]