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
    >>>
  • 相关阅读:
    HTTP协议
    OSI层次关系
    Python之web框架
    数据操作,流程控制语句
    Django简介
    函数
    2017java预留作业 1502 程逸飞
    2017java 预留作业2
    python django 项目支付
    如果注册xadmin出现了这个错误
  • 原文地址:https://www.cnblogs.com/kerrycode/p/7638884.html
Copyright © 2011-2022 走看看