E
export
The following code
##############
import string
MyList=['abc','def']
for i in MyList:
print i
###############
works as I expect that is I get
abc
def
but when I have Mylist in a file and I read it from the file it does
not work as I expect.
#########
import string
ff=open('C:\\Robotp\\MyFile.txt','r') # read MyList from a file
MyList=ff.read()
for i in MyList:
print i
###########
I will get
[
'
a
b
c
'
,
'
d
e
f
'
]
where my MyFile.txt looks like this:
['abc','def']
Where is a problem?
Thanks for help
Lad
##############
import string
MyList=['abc','def']
for i in MyList:
print i
###############
works as I expect that is I get
abc
def
but when I have Mylist in a file and I read it from the file it does
not work as I expect.
#########
import string
ff=open('C:\\Robotp\\MyFile.txt','r') # read MyList from a file
MyList=ff.read()
for i in MyList:
print i
###########
I will get
[
'
a
b
c
'
,
'
d
e
f
'
]
where my MyFile.txt looks like this:
['abc','def']
Where is a problem?
Thanks for help
Lad