`

NameError: name 'raw_input' is not defined

阅读更多

版本:Python 3.3.4

错误:name 'raw_input' is not defined

原因:版本3.X 中去掉了raw_input 函数,改用input。

分享到:
评论

相关推荐

    Python2中的raw_input() 与 input()

    NameError: name 'abc' is not defined >>> input_A = input("Input:") Input:"abc" ``` - **解释**:`raw_input()` 直接返回字符串 `"abc"`,而 `input()` 期望一个合法的Python表达式。当未使用引号时,它...

    Python中input与raw_input 之间的比较

    Python中input与raw_input 之间的比较 input和raw_input均可以接收输入,其差别如下所示: #input假设用户输入的是合法的Python表达式 >>> name = input("what is ...NameError: name 'ZJ' is not defined #于是,必

    Python核心编程(第二版)第十章练习答案

    - (c) `NameError: name 'x' is not defined` - (d) `ZeroDivisionError: integer division or modulo by zero` - (e) `ValueError: math domain error` **解析**: 这些错误都是因为代码中存在明显的语法或逻辑问题...

    python2.x和python3.x的区别

    print(x) # 报错:NameError: name 'x' is not defined ``` #### 9. 比较无序类型 - **变化**:在Python 2.x中,可以比较不同的无序类型(如dict和set);而在Python 3.x中,比较不同类型时会引发TypeError。 - ...

    Python简明手册.docx

    print a # NameError: name 'a' is not defined ``` 在上面的示例中,我们使用 del 语句来删除列表 a 中的元素,并观察输出结果。 ### 2.8 try ... except ... finally Python 中的 try ... except ... finally ...

    python2 与 pyhton3的输入语句写法小结

    NameError: name 'hello' is not defined ``` 要输入字符串,需要使用引号包裹: ```python >>> r = input("'hello'") 'hello' ``` - **`raw_input()` 函数**: 这个函数总是将输入视为字符串类型,无论...

    php.ini-development

    directive because it is not set or is mistyped, a default value will be used. ; The value can be a string, a number, a PHP constant (e.g. E_ALL or M_PI), one ; of the INI constants (On, Off, True, ...

    acpi控制笔记本风扇转速

    exclusion and the interrupt level indication flag is not needed. Fixed a problem with the Global Lock where the lock could appear to be obtained before it is actually obtained. The global lock ...

    Google C++ Style Guide(Google C++编程规范)高清PDF

    This is because static data members are defined outside the class definition. On the other hand, you must include the header file for Foo if your class subclasses Foo or has a data member of type ...

    nao机器人java语音源码

    /// Loads a set of voice parameters defined in a xml file contained in the preferences folder.The name of the xml file must begin with ALTextToSpeech_Voice_ /// /// <param name="pPreferenceName"> ...

    ZendFramework中文文档

    Querying if the input is valid 14.5.3.2. Getting Invalid, Missing, or Unknown Fields 14.5.3.3. Getting Valid Fields 14.5.4. Using Metacommands to Control Filter or Validator Rules 14.5.4.1. The ...

    Bochs - The cross platform IA-32 (x86) emulator

    - Local APIC configure option --enable-apic is deprecated and should not be used anymore. The LAPIC option now automatically determined from other configure options. XAPIC functionality could be ...

    python3.6.5参考手册 chm

    PEP 3155: Qualified name for classes and functions PEP 412: Key-Sharing Dictionary PEP 362: Function Signature Object PEP 421: Adding sys.implementation SimpleNamespace Using importlib as the ...

    USB Complete 3rdEdition

    Error Checking 56 3. A Transfer Type for Every Purpose 61 Control Transfers 61 Availability 62 Structure 62 Data Size 66 Speed 66 Detecting and Handling Errors 68 Bulk Transfers 68 Availability 69 ...

    vxworks_kernel_programmers_guide_6.9

    Error Detection and Reporting Policy Hooks ............................................... 18 Task Switch Hook Support .............................................................................. 18...

    Google C++ International Standard.pdf

    6.4 Name lookup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 6.5 Program and linkage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ....

Global site tag (gtag.js) - Google Analytics