If you have a file "ints.txt" with contents

10 20
30
40 50 60

You could read integers into a list with

ivec = []
for text in open("ints.txt","r"):
words = text.split()
for x in words:
ivec.append(int(x))
print ivec

If you know you want to read two integers into variables a,b from a
line you could write

a,b = int(words[0]),int(words[1])

Excuse me, but if your question is really so elementary that this post
answered it, you should probably read a book or tutorial.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to