• 技术文章 >常见问题 >Python常见问题

    python 3.3使用print输出保语法错误是什么原因?

    yangyang2020-05-28 16:12:30原创2538

    在python3.3使用下面的print语句打印时会报错:

    print "hello World"

    报错如下:

    File "<ipython-input-3-c3365d283592>", line 1

    print "hello World"

    ^

    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("hello World")?

    原因:

    在Python 3中print已变成可调用函数而不是语句。所以在我们使用print打印时需要将打印内容使用()包含。

    如下:

    print("hello World")

    输出结果:

    hello World

    更多Python知识请关注Python自学网

    专题推荐:python
    品易云
    上一篇:pdf如何用python读取? 下一篇:Python包括哪4种数值类型?

    相关文章推荐

    • python怎么导入图片?• python操作微信客户端:WechatPCAPI库实现自动化回复• python map()函数怎么用?

    全部评论我要评论

    © 2021 Python学习网 苏ICP备2021003149号-1

  • 取消发布评论
  • 

    Python学习网