[Tutor] reafline reads file, not just 1 line

Luke Paireepinart rabidpoobear at gmail.com
Fri Mar 30 09:43:21 CEST 2007


Kirk Bailey wrote:
> a relevant code snip:
>
> if os.path.exists('ConfigureMe'):
> 	f1=open('ConfigureMe','r')
> 	tablebgcolor=string.strip(f1.readline())
> 	papercolor=string.strip(f1.readline())
> 	inkcolor=string.strip(f1.readline())
> 	linkcolor=string.strip(f1.readline())
> 	f1.close()
>
> Eacj line in the file contains color configuration information to 
> include into a webpage later on (for instance, 'peach, 'wjhite', 
> 'black', 'Blue').
>
> tablebgcolor contains the entire text file being read, not one line.
>
> this program opereates in a windows 2000 environment if this helps any.
>
> when examined in a text editor, the file is properly laid out. pLease 
> help, the fingernails are getting very close to the quick.
>   
Let us take a gander at this file.  Include it as an attachment.
I see no reason why your code wouldn't work.
You sure you didn't accidentally make the first a call to readlines()? 
(note the 's')
-Luke
>
>
>   



More information about the Tutor mailing list