摘要:
a = 2 def wrapper(): a += 1 print(a) wrapper() 局部变量不能修改全局变量 阅读全文
摘要:
def func2(): print(2) def func3(): print(6) print(4) func3() print(8) print(3) func2() print(5) 结果: 3 2 4 6 8 5 阅读全文
摘要:
def func(*args,**kwargs): print(args,kwargs) func(1,2,3,'hhh',name = 'cbb') (1, 2, 3, 'hhh') {'name': 'cbb'} 函数内,调用: def func(*args): print(args) list 阅读全文
摘要:
def func(*argvs): number = 0 for i in argvs: number += i return number print(func(1,2,3,4)) 阅读全文
摘要:
def register(name,sex,age,edu): with open('student_msg.txt','a') as f1: f1.write(f'{name},{sex},{age},{edu}\n') n,s,a,e = input('输入姓名、性别、年龄、学历,并以逗号隔开' 阅读全文