Δημοσιεύτηκε: 09 Απρ 2010, 13:11
από medigeek
@magaiver

Το input() είναι μια από τις διαφορές python3 vs. python2

Για python3 χρησιμοποιείς το input():
http://docs.python.org/py3k/library/fun ... html#input

Κώδικας: Επιλογή όλων
$ python3
Python 3.1.2 (r312:79147, Mar 21 2010, 19:29:49)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> input("Your name: ")
Your name: Savvas
'Savvas'


Για python 2.x χρησιμοποιείς το raw_input():
http://docs.python.org/library/functions.html#raw_input

Κώδικας: Επιλογή όλων
$ python
Python 2.6.5 (r265:79063, Apr 3 2010, 01:56:30)
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> raw_input("Your name: ")
Your name: Savvas
'Savvas'