[Tutor] help
james middendorff
james2dope@yahoo.com
Wed, 10 Oct 2001 16:05:31 -0700 (PDT)
--0-1370392546-1002755131=:9199
Content-Type: text/plain; charset=us-ascii
I have fixed my last post but I do have a question, I would like to keep looping this over and over until you type quit,thanks for the help!
import os, sys
try:
while 1:
filename = raw_input("whats the file?('quit' to quit)")
if filename == 'quit':
sys.exit()
inp = open(filename, "r")
for line in inp.readlines():
print line
inp.close()
except IOError:
print "Error: there is no file there!"
"I would kill everyone in this room
for a drop of sweet beer."
----Homer Simpson----
---------------------------------
Do You Yahoo!?
Make a great connection at Yahoo! Personals.
--0-1370392546-1002755131=:9199
Content-Type: text/html; charset=us-ascii
<P>I have fixed my last post but I do have a question, I would like to keep looping this over and over until you type quit,thanks for the help!</P>
<P>import os, sys<BR>try:<BR> while 1:<BR> filename = raw_input("whats the file?('quit' to quit)")<BR> if filename == 'quit':<BR> sys.exit()<BR> <BR> inp = open(filename, "r")<BR> for line in inp.readlines():<BR> print line<BR> inp.close() <BR> <BR>except IOError:<BR> print "Error: there is no file there!"</P><BR><BR>"I would kill everyone in this room<br> for a drop of sweet beer."<br> ----Homer Simpson----<p><br><hr size=1><b>Do You Yahoo!?</b><br>
Make a great connection at <a
href="http://rd.yahoo.com/mktg/mail/txt/tagline/?http://personals.yahoo.com" target="_blank">Yahoo! Personals</a>.
--0-1370392546-1002755131=:9199--