# 不定长参数,如:计算任意个数字的和,但是他不能接受关键字实参
所以就有**
def fn(*args):
result = 0
for i in args:
result += i
print(result)
fn(2, 5, 6, 7, 8, 9, 4, 3)
============================
# 不定长参数,如:计算任意个数字的和
def fn(*args, **kwargs):
result = 0
for i in args:
result += i
print(result)
fn(2, 5, 6, 7, 8, c=9, b=4, a=3)
# help函数查询 参数是对像,步是调用
print(help(print))
=====================================打印结果,将print的用法打印出来
print(...)
print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)
Prints the values to a stream, or to sys.stdout by default.
Optional keyword arguments:
file: a file-like object (stream); defaults to the current sys.stdout.
sep: string inserted between values, default a space.
end: string appended after the last value, default a newline.
flush: whether to forcibly flush the stream.
None
若是你也想用help打印出来===========================================
def penson():
"""
文档说明:
此函数的功能====,这里就是写说明的
为的是让别人易读
"""
pass
print(help(penson))