首页 > 代码库 > Python Special Syntax 2
Python Special Syntax 2
a=Nonefor i in a: print(‘zheli de i shi %d‘ % i)
报错: TypeError: ‘NoneType‘ object is not iterable
除非你提供你自己的
return
语句,每个函数都在结尾暗含有return None
语句。
关于DocString:
def testing(x): ‘‘‘This is a test function.This is a great feature.You must learn how to use this.‘‘‘ print(‘Your input is ‘,x)print(testing.__doc__)testing(18)testing(5)help(testing)
输出:This is a test function.
This is a great feature.You must learn how to use this.
(‘Your input is ‘, 18)
(‘Your input is ‘, 5)
Help on function testing in module __main__:testing(x)
This is a test function.
This is a great feature.You must learn how to use this.
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。