[Tutor] reafline reads file, not just 1 line
Kirk Bailey
deliberatus at verizon.net
Fri Mar 30 17:42:29 CEST 2007
BINGO! Perfect function!
GOD?**** windows. BUT THANK YOU!
(walks off mumbling curses at the billster of gates...)
Kent Johnson wrote:
> Kirk Bailey wrote:
>> a relevant code snip:
>>
>> if os.path.exists('ConfigureMe'):
>> f1=open('ConfigureMe','r')
>> tablebgcolor=string.strip(f1.readline())
>>
>> 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.
>
> My guess is that the file contains non-native newlines. Try opening it
> with universal newline support using
> f1=open('ConfigureMe','rU')
>
> Kent
>
>
--
Salute!
-Kirk Bailey
Think
+-----+
| BOX |
+-----+
knihT
Fnord.
More information about the Tutor
mailing list