Re: New to Python - Easy way to open a text file



nothing is "lame" to me , all help is appreciated :)

..\\ax


<kyosohma@xxxxxxxxx> wrote in message
news:1175282893.015117.154310@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
On Mar 30, 11:39 am, Marc 'BlackJack' Rintsch <bj_...@xxxxxxx> wrote:
In <1175270675.296617.83...@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>, kyosohma
wrote:
I'm not familiar with ezt formats, however reading a text file is a
breeze.

This sentence doesn't match the code that follow. It's really simpler
than that ``while`` loop.

f = open(r'pathToFile')
while True:
line = f.readline()
if not line: break
# do something with the line of text such as print it.

f.close()

f = open(r'pathToFile)
for line in f:
# do something with the line of text such as print it.
f.close()

Ciao,
Marc 'BlackJack' Rintsch

Yes, the "while" is lame, I admit it. But sometimes you just gotta go
old school!

Mike



.



Relevant Pages

  • Re: Help needed
    ... Yes because Everton went to school didn't they! ... FFS the replies I get on here nowadays are as piss poor as your team's ... If there's one thing funnier than a lame tw@t who has no comeback ... other than to spell flame, it's a lame tw@t who spell flames and makes ...
    (uk.sport.football.clubs.liverpool)
  • Re: New to Python - Easy way to open a text file
    ... breeze. ... than that ``while`` loop. ... But sometimes you just gotta go ... old school! ...
    (comp.lang.python)
  • Re: Celestron Sky Scout
    ... Guess it would not be useful in the daytime; gotta be pretty lame to not find the Sun. ...
    (sci.astro.amateur)
  • Re: Arnii needs a spanking
    ... Another IKYABWAI barrage from SnottyBorg. ... Lame, lame, lame. ... I'll be glad to school you in riposting a schoolyard ... Here's a free lesson. ...
    (rec.audio.opinion)
  • Re: Artie will start getting healthy right now
    ... "Mike Rose is Tall" wrote ... my future like that and they gotta go...they immediately become a lame ... duck. ...
    (alt.fan.howard-stern)