How can you to store and retrieve numbers, and also change them, in Python
I have a set of 3 (2, 100, 150) numbers and I want to retrieve them from a
.txt file and change them and then put them back. I have tried thousands
of things but I cannot find anything.
This is some code that I have tried so if there are any mistakes that I
have made can you please try and correct them.
with open('bankstatmentrubyoscarpoints.py') as f:
for ln in f:
a = [int(x) for x in ln.split()]
date = a[0]
credit = a[1]
balence = a[2]
ndate = raw_input('new date is')
ncredit = raw_input('the new credit is')
f.write('\n')
f.write(ndate)
f.write('\t')
f.write(ncredit)
f.write('\t')
f.write(nbalence)
f.close
So an answer will be amazing!
No comments:
Post a Comment