推荐学习书目
› 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
ericbize
V2EX  ›  Python

请教返回值问题

  •  
  •   ericbize · Oct 15, 2017 · 3220 views
    This topic created in 3310 days ago, the information mentioned may be changed or developed.

    def check (C1,C,H,T):

    if C1 != C:
        return temprecrive()
    
    else :
        print H
        print T
        return ( H,T )
    

    然后运行的时候就提示返回 None 了。

    https://www.v2ex.com/i/5dA494gq.png

    10 replies  •  2017-10-16 08:55:49 +08:00
    BingoXuan
    BingoXuan
    Oct 15, 2017 via Android
    1
    return 后面括号是中文括号,源码也是吗?
    ipwx
    ipwx
    Oct 15, 2017
    2
    你的截图里面是 temprecrive 这个函数返回了 None。

    然后你试图 (H, T) = temprecrive(),这句话报错了
    litter123
    litter123
    Oct 15, 2017
    3
    把(H, T) = temprecrive()括号删掉,改为:

    H, T = temprecrive()

    试试
    ericbize
    ericbize
    OP
    Oct 15, 2017
    4
    @BingoXuan 数字啊
    ericbize
    ericbize
    OP
    Oct 15, 2017
    5
    H,T =ftemper.temprecrive()
    print H

    这样吗? 还是不行
    @litter123
    ericbize
    ericbize
    OP
    Oct 15, 2017
    6
    @ipwx 对啊,我就不知道为什么 print 的时候还是数字,然后 return 的时候就变成 None 了
    azh7138m
    azh7138m
    Oct 15, 2017
    7
    ericbize
    ericbize
    OP
    Oct 15, 2017 via iPhone
    8
    @azh7138m 真的不是我发的,我在 google 找了半天没找到
    msg7086
    msg7086
    Oct 16, 2017
    9
    @ericbize
    人家说的是

    显然是你的问题

    不是

    显然是你发的问题
    ericbize
    ericbize
    OP
    Oct 16, 2017
    10
    @msg7086 emmmmm
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1659 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 05:16 · PVG 13:16 · LAX 21:16 · JFK 00:16
    ♥ Do have faith in what you're doing.