zoukankan      html  css  js  c++  java
  • SyntaxError: Missing parentheses in call to 'print'

    C:Userskonglb>python
    Python 3.6.3 (v3.6.3:2c5fed8, Oct  3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> print 'hello, python world';
      File "<stdin>", line 1
        print 'hello, python world';
                                  ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print('hello,
    python world';)?

     

     

    其实这个错误信息,是因为Python3中取消了以前Python 2中的语法,两者在打印输出的语法上有所差别,所以在Python 3下面使用之前的语法格式就会报错,错误信息已经提示你需要加上括号,字符串可以用单引号或双引号括起来,正确语法格式如下所示:

     

    C:Userskonglb>python -V
    Python 3.6.3
     
    >>> print ('hello,python world')
    hello,python world
    >>> print("you are right")
    you are right
    >>>
  • 相关阅读:
    单例模式
    二、CSS
    十一、多线程
    十二、协程
    十、多进程
    九、内存管理
    八、元类
    七、上下文管理器/魔术方法
    六、单例模式
    五、装饰器
  • 原文地址:https://www.cnblogs.com/kerrycode/p/7638884.html
Copyright © 2011-2022 走看看