[Tutor] interactive script
Alan Gauld
alan.gauld at btinternet.com
Fri Jan 31 21:32:58 CET 2014
On 31/01/14 15:08, Gabriele Brambilla wrote:
> Hi,
> I'm very new to Python (just 5 days!)
> is there a possibility to write an interactive script?
Yes,
If using Python v3 use input()
If using Python v2 use raw_input() (and definitely not input() )
You'll get a string back so may need to convert
it to int() or float() or whatever.
If you really insist on reading multiple values in
a single line of input look at str.split() or
for scanf style handling try the struct module,
although it's not really intended for user input...
HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list