In article <4b617f4...@dnews.tpgi.com.au>,
Lie Ryan wrote:
>
>f = open('input.txt', 'r+')
>for line in f:
>s = line.replace('python', 'PYTHON')
># f.tell()
>f.write(s)
>
>When f.tell() is commented, 'input.txt' does not change; but when
>uncommented, the f.write() succeeded writing in
* Anthony Tolle:
On Jan 28, 7:12 am, Lie Ryan wrote:
In the code:
"""
f = open('input.txt', 'r+')
for line in f:
s = line.replace('python', 'PYTHON')
# f.tell()
f.write(s)
"""
[snip]
My guess is that there are a few possible problems:
1) In this case, writing to file opened with
On Jan 28, 7:12 am, Lie Ryan wrote:
> In the code:
>
> """
> f = open('input.txt', 'r+')
> for line in f:
> s = line.replace('python', 'PYTHON')
> # f.tell()
> f.write(s)
> """
> [snip]
My guess is that there are a few possible problems:
1) In this case, writing to file opened with '
In the code:
"""
f = open('input.txt', 'r+')
for line in f:
s = line.replace('python', 'PYTHON')
# f.tell()
f.write(s)
"""
When f.tell() is commented, 'input.txt' does not change; but when
uncommented, the f.write() succeeded writing into the 'input.txt'
(surprisingly, but not entirel