推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
123s
V2EX  ›  Python

py 新人, print 死活不知道哪里错

  •  
  •   123s · Mar 20, 2017 · 2714 views
    This topic created in 3518 days ago, the information mentioned may be changed or developed.
    import os
    from multiprocessing import Process
    
    def child_proc(name): 
        print "Run child process %s (%s)..." % (name, os.getpid())
    
    if __name__ == '__main__':
        print "Parent process %s." % (os.getpid())
        p = Process(target=child_proc, args=('test',))
        print 'Process will start.'
        p.start()
        p.join()
        print 'Process end.'
    
      File "r.py", line 5
        print "Run child process %s (%s)..." % (name, os.getpid())
                                           ^
    SyntaxError: invalid syntax
    

    格式化有问题吗,看不出来啊

    zhangshine
    zhangshine
    Mar 20, 2017
    1
    Python 什么版本?
    123s
    123s
    OP
    Mar 20, 2017
    2
    eloah
    eloah
    Mar 20, 2017❤️1
    3
    ......py3 里面 print 已经是一个函数了
    D3EP
    D3EP
    Mar 20, 2017 via Android
    4
    print()
    123s
    123s
    OP
    Mar 20, 2017
    5
    @eloah 懂了..
    123s
    123s
    OP
    Mar 20, 2017
    6
    @eloah 你也 在珠海啊
    wohenyingyu02
    wohenyingyu02
    Mar 20, 2017
    7
    请看 python3 入门教材第一页的 hello world 程序就知道了
    ytmsdy
    ytmsdy
    Mar 20, 2017 via iPhone
    8
    这是 2.7 的写法!
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   2249 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 11:50 · PVG 19:50 · LAX 03:50 · JFK 06:50
    ♥ Do have faith in what you're doing.