[EMAIL PROTECTED] wrote:
hi every body,
I'm a new python user and I'm making a program to run useing Abaqus
and there is something I can't do,
if i have a text file that has a line like this " 10 20 30 40
50" and I wana do the coding to put every number of these like 10 or
20 in a separate variable .. any suggestions ??
thanks in advance
The problem with you not actually trying anything and posting it here is that we
have no real idea if 10, 20, ... 50 should be strings, integers, floats,
hexadecimal, or decimal "variables".
Assuming you mean integers:
fp=open('textfile.txt')
l=fp.readline()
a,b,c,d,e = [int(x) for x in l.split()]
fp.close()
More likely you need:
values = [int(x) for x in l.split()]
-Larry
--
http://mail.python.org/mailman/listinfo/python-list