File write/read question

Fernando Pérez fperez528 at yahoo.com
Tue May 14 20:48:17 EDT 2002


Nathan Hellmers wrote:

> test2 = open("test.txt", "r")
> a = test2.readline()
> int(a)
> print a + a
> 

Change to:

test2 = open("test.txt", "r")
a = int(test2.readline().strip())
print a + a

and you should be fine.

f.



More information about the Python-list mailing list