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
ericbize
V2EX  ›  Python

请教返回值问题

  •  
  •   ericbize · 2017-10-15 09:20:03 +08:00 · 2313 次点击
    这是一个创建于 2347 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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 条回复    2017-10-16 08:55:49 +08:00
    BingoXuan
        1
    BingoXuan  
       2017-10-15 10:16:10 +08:00 via Android
    return 后面括号是中文括号,源码也是吗?
    ipwx
        2
    ipwx  
       2017-10-15 11:06:15 +08:00
    你的截图里面是 temprecrive 这个函数返回了 None。

    然后你试图 (H, T) = temprecrive(),这句话报错了
    litter123
        3
    litter123  
       2017-10-15 11:14:09 +08:00
    把(H, T) = temprecrive()括号删掉,改为:

    H, T = temprecrive()

    试试
    ericbize
        4
    ericbize  
    OP
       2017-10-15 11:20:24 +08:00
    @BingoXuan 数字啊
    ericbize
        5
    ericbize  
    OP
       2017-10-15 11:22:06 +08:00
    H,T =ftemper.temprecrive()
    print H

    这样吗? 还是不行
    @litter123
    ericbize
        6
    ericbize  
    OP
       2017-10-15 11:22:49 +08:00
    @ipwx 对啊,我就不知道为什么 print 的时候还是数字,然后 return 的时候就变成 None 了
    azh7138m
        7
    azh7138m  
       2017-10-15 15:14:10 +08:00
    ericbize
        8
    ericbize  
    OP
       2017-10-15 15:26:55 +08:00 via iPhone
    @azh7138m 真的不是我发的,我在 google 找了半天没找到
    msg7086
        9
    msg7086  
       2017-10-16 04:13:28 +08:00
    @ericbize
    人家说的是

    显然是你的问题

    不是

    显然是你发的问题
    ericbize
        10
    ericbize  
    OP
       2017-10-16 08:55:49 +08:00
    @msg7086 emmmmm
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3534 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 11:02 · PVG 19:02 · LAX 04:02 · JFK 07:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.