faqts : Computers : Programming : Languages : Python : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

14 of 15 people (93%) answered Yes
Recently 7 of 8 people (88%) answered Yes

Entry

Is there an easy way to do user input in python?

Jun 5th, 2000 06:25
unknown unknown, Steven Adams


use raw_input

>>> def get_SPAM_n_EGGS():
                    spam = raw_input('Spam? ')
                    eggs = raw_input('and Eggs? ')
                    print spam, eggs


>>> get_SPAM_n_EGGS()
Spam? loads
and Eggs? yessiree
loads yessiree
>>>