How do I use raw

import sys
print (sys.platform)
print (2 ** 100)
raw_input( )

I am using Python 3.1 and can't get the raw_input to "freeze" the dos pop-up. The book I'm reading is for 2.5 and I'm using 3.1

What should I do to fix this?


raw_input() was renamed to input()

From http://docs.python.org/dev/py3k/whatsnew/3.0.html


这适用于Python 3.x和2.x:

# Fix Python 2.x.
try: input = raw_input
except NameError: pass
print("Hi " + input("Say something: "))

A reliable way to address this is

from six.moves import input

six is a module which patches over many of the 2/3 common code base pain points.

链接地址: http://www.djcxy.com/p/9650.html

上一篇: 输入()和输入()在python3.x?

下一篇: 我如何使用原始的