学习python第n天——我在看笨办法学python
代码块
#this is like your scripts with argv. def print_two(*args):#def含义define(定义) arg1 , arg2 = args print(f"arg1:{arg1},arg2:{arg2}") #ok,that *args is actually pointless,we can just do it def print_two_argin(arg1,arg2): print(f"arg1:{arg1},arg2:{arg2}") #this just takes one argument def print_one(arg1): print(f"arg1:{arg1}") #this one takes no arguments def print_none(): print("i got nothin'.") print_two("zed","shaw") print_two_argin("zed","shaw") print_one("first!") print_none()
运行结果
PS C:\Users\HH\lpthw> python ex9.py
arg1:zed,arg2:shaw
arg1:zed,arg2:shaw
arg1:first!
i got nothin'.
PS C:\Users\HH\lpthw>
浙公网安备 33010602011771号