"Bryan Fodness" <[EMAIL PROTECTED]> wrote
f = open(infile, 'r')
s = f.readlines()
f.close()
This just reads the lines as text from the file.
It includes any whitespace and linefeeds in the file.
Block = str(s[1])
Since its text you don;t need the str() but you probably
should use rstrip() to rem,ove any training whitespace
or newlines.
Block = s[1].rstrip()
Angle = float(s[2])
This should be OK
Position = str(s[3])
As per Block
if Block == 'Custom':
print 'equal'
if I print Block+'Custom', I get,
Custom
Custom
Block obviously has a newline.
Try
print repr(Block)
to see the \n
More info on this in my Handling Files topic ih my tutorial.
HTH,
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor