V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2017 年 3 月 20 日 · 2276 次点击
    这是一个创建于 3233 天前的主题,其中的信息可能已经有所发展或是发生改变。
    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
        1
    zhangshine  
       2017 年 3 月 20 日
    Python 什么版本?
    123s
        2
    123s  
    OP
       2017 年 3 月 20 日
    eloah
        3
    eloah  
       2017 年 3 月 20 日   ❤️ 1
    ......py3 里面 print 已经是一个函数了
    D3EP
        4
    D3EP  
       2017 年 3 月 20 日 via Android
    print()
    123s
        5
    123s  
    OP
       2017 年 3 月 20 日
    @eloah 懂了..
    123s
        6
    123s  
    OP
       2017 年 3 月 20 日
    @eloah 你也 在珠海啊
    wohenyingyu02
        7
    wohenyingyu02  
       2017 年 3 月 20 日
    请看 python3 入门教材第一页的 hello world 程序就知道了
    ytmsdy
        8
    ytmsdy  
       2017 年 3 月 20 日 via iPhone
    这是 2.7 的写法!
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   2339 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 33ms · UTC 01:40 · PVG 09:40 · LAX 17:40 · JFK 20:40
    ♥ Do have faith in what you're doing.