newbie question

  • Thread starter Christoph Lehmann
  • Start date
C

Christoph Lehmann

hi
I need to read in a textfile, where in each line are two strings:

e.g

aa 1
bb 0
cc 1
aa 0
dd 0


how can I read in each line and put the first string into one variable,
the second into another variable

with just one string per line, I did:

f = open(myfile, 'r')
for filename in f.readlines():
mylist.append(string.rstrip(filename)) #remove \n
or \r\n
f.close()

many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top