append追加的使用

 1 #!/usr/bin/env python
 2 def fun(arg) :
 3     ret = []
 4     for i in range(len(arg)) :
 5         if i % 2 ==1 :
 6             ret.append(arg[i])
 7         else :
 8             pass
 9     return ret
10 li = [11,22,33,44,55]
11 r = fun(li)
12 print(li)
13 print(r)
原文地址:https://www.cnblogs.com/shiluoliming/p/6217109.html