Help: low level user input

K

Kyle E

Ok, I have a little tiny problem, a beginner problem, that I am overlooking.
I am writing a Information Gathering Program, that takes user input from
scripted questions and prints them in a handy list in the end. As of now,
when one of my questions is asked, the only possible way to enter text is to
type ( "John" ) minus the parenthesis. You do need the qoutation marks
though. I just want to be able to type ( John ) without the unneeded
quotation marks. I know someone has the answer, sorry for the inexperienced
question, but it's ticking me off.

This is my program:

from time import sleep

##INTRODUCTION
print "Personal Information Program"
print "----------------------------"
print
sleep(3)
print "Please input the requested information... "
sleep(1)

##INPUT NAME
print "ID: "
sleep(2)
print "What is your first name?"
fname = input ("> ")
sleep(1)
print "What is your middle initial?"
mname = input ("> ")
sleep(1)
print "What is your last name?"
lname = input ("> ")
sleep(1)

##INPUT ADDRESS
print "Location: "
sleep(2)
print "What is your street address?"
saddy = input ("> ")
sleep(1)
print "What city do you live in?"
city = input ("> ")
sleep(1)
print "What state do you live in?"
state = input ("> ")
sleep(1)
print "What is your zipcode?"
zip = input ("> ")
sleep(1)
print "Do you have a P.O. Box?"
poan = input ("> ")
if poan == yes:
print "What is your P.O. Box number?"
pobox = input ("> ")
 
P

Peter Otten

Kyle said:
Ok, I have a little tiny problem, a beginner problem, that I am
overlooking. I am writing a Information Gathering Program, that takes user
input from scripted questions and prints them in a handy list in the end.
As of now, when one of my questions is asked, the only possible way to
enter text is to
type ( "John" ) minus the parenthesis. You do need the qoutation marks
though. I just want to be able to type ( John ) without the unneeded
quotation marks. I know someone has the answer, sorry for the
inexperienced question, but it's ticking me off.

Use raw_input() instead of input() to get the string as typed by the user.
input() evaluates the user input what is definitely not what you want in
your little program, e. g:
Peter
'John'

or most likely:
First name John
Traceback (most recent call last):
File "<stdin>", line 1, in ?

HTH,
Peter
 
K

Kyle E

Use raw_input() instead of input() to get the string as typed by the user.
input() evaluates the user input what is definitely not what you want in
your little program, e. g:

Peter
'John'

or most likely:

First name John
Traceback (most recent call last):
File "<stdin>", line 1, in ?


HTH,
Peter

Kyle Wrote:

I forgot about using raw_input, now I can finish writing my program, Thanks
a lot Peter
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top