1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/usr/bin/env python
#encoding:utf-8
def sum(x,*xarg):
print x
sum=x
print xarg
for
i
in
xarg:
sum+=i
return
sum
if
__name__ ==
"__main__"
:
result=sum(1,2,3,4,6,7)
print result
|
1
2
3
4
5
6
7
8
9
10
|
[root@oldboy ~]# cat ts.py
#!/bin/python
#coding:utf-8
def add_function(a, b):
c = a + b
return
c
if
__name__ ==
"__main__"
:
result = add_function(10,20):
return
result
[root@oldboy ~]#
|
本文转自 小小三郎1 51CTO博客,原文链接:http://blog.51cto.com/wsxxsl/1834918,如需转载请自行联系原作者