
本文共 2196 字,大约阅读时间需要 7 分钟。
������������
���������������������������������������������������������������������������������������������������������������������������������������������������
������1���
#-*- coding:utf-8 -*-def test(a,b):������#���������������������������a���b result = a+b print("result=%d"%result)test(11,22)������#������������������������������test(22,22)test(33,22)root@ubuntu:/home/python/codes/python������-05# python2 test.py result=33result=44result=55
������������������������������������������������������������������������������������������������������������������test������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������
#-*- coding:utf-8 -*-def test(a,b=22):������#���������b=22������������������ result = a+b print("result=%d"%result)test(11)test(22)test(33)root@ubuntu:/home/python/codes/python������-05# python3 test.py result=33result=44result=55
������2���
���������������������help()������������������������������������������������������������������������
In [1]: help(print)Help on built-in function print in module builtins:print(...) print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=False)������#end='\n'������������������������������������������������������������������������������������������������ 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.
������3���
In [2]: def test(a,b=22,c=33):������#���������������������������b���c������������������������������ ...: print(a) ...: print(b) ...: print(c) ...: In [3]: test(11,c=44)������#������������������������a���������11,c���������44112244
发表评论
最新留言
关于作者
