Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need serious help.
#3
To get input from the user, use the input function:

read_name = input('Please enter the name of the file to read: ')
I'm not sure exactly what he means by try/except for a file, but I assume he means something like this:

try:
    read_file = open(read_name)
except IOError:
    # give a warning to the user and quit the program.
It may be something he went over in class, I'd check any materials he's handed out.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
I need serious help. - by forumer444 - Sep-13-2017, 08:10 PM
RE: I need serious help. - by buran - Sep-13-2017, 08:20 PM
RE: I need serious help. - by forumer444 - Sep-14-2017, 12:57 AM
RE: I need serious help. - by ichabod801 - Sep-13-2017, 08:22 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020