发布时间:2019-09-24 08:26:54编辑:auto阅读(1723)
自定义函数:
def myfun(args1,args2):
函数体
return value
def get_info():
userinfo = {}
with open("info.txt","r",encoding="utf-8") as f:
lines = f.readlines()
for line in lines:
line = line.strip()
line = line.split(" ")
#print(line[0])
if not(line[0] == ''):
userinfo[line[0]] =line[1]
else:
pass
#print("读取到空行")
return userinfo
调用函数:
get_info()
递归调用:0
def move(rank,s1,s2,s3):
if(rank == 1):
print("移动%d盘子%c到%c",rank,s1,s3)
else:
move(rank-1,s1,s3,s2)
print("移动%d盘子%c到%c", rank, s1, s3)
move(rank-1,s2,s1,s3)
move(3, 'A', 'B', 'C')
上一篇: 通过Python3+selenium自动
下一篇: python基础3——运算符
47776
46290
37179
34669
29262
25920
24808
19896
19456
17951
5747°
6351°
5865°
5917°
7018°
5853°
5878°
6384°
6343°
7712°