raw_input on several lines
David
david at abbottdavid.com
Sat Aug 2 16:34:02 EDT 2008
TP wrote:
> Hi everybody,
>
> When using raw_input(), the input of the user ends when he types Return on
> his keyboard.
> How can I change this behavior, so that another action is needed to stop the
> input? For example, CTRL-G. It would allow the user to input several lines.
>
> Thanks
>
> Julien
>
>
>
How about;
student_scores = {}
name = raw_input("Please enter a student name (q quits): ")
while(name != 'q'):
score = input("Please enter the students score: ")
student_scores[name] = score
name = raw_input("Please enter a student name (q quits): ")
for current_key in student_scores.keys():
print "The current students are:", current_key
--
Powered by Gentoo GNU/LINUX
http://www.linuxcrazy.com
More information about the Python-list
mailing list