How do I use raw_input in Python 3

后端 未结 8 2491
旧时难觅i
旧时难觅i 2020-11-22 01:39
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-

8条回答
  •  孤城傲影
    2020-11-22 02:09

    Timmerman's solution works great when running the code, but if you don't want to get Undefined name errors when using pyflakes or a similar linter you could use the following instead:

    try:
        import __builtin__
        input = getattr(__builtin__, 'raw_input')
    except (ImportError, AttributeError):
        pass
    

提交回复
热议问题