码迷,mamicode.com
首页 > 编程语言 > 详细

Python Special Syntax 2

时间:2014-07-02 17:31:36      阅读:189      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   cti   for   io   

 

a=None

for 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.

 

 

Python Special Syntax 2,布布扣,bubuko.com

Python Special Syntax 2

标签:style   blog   color   cti   for   io   

原文地址:http://www.cnblogs.com/yanyuge/p/3819919.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!