Python是簡單地造就另一個提示,當我從Zed的肖鍛鍊18爲什麼這個def函數沒有在Python中執行?
# this one is like our scripts with argv
def print_two(*args):
arg1, arg2 = args
print "arg1: %r, arg2: %r" % (arg1, arg2)
# ok, that *args is actually pointless, we can just do this
def print_two_again(arg1, arg2) :
print "arg1: %r, arg2: %r" % (arg1, arg2)
# this just takes one argument
def print_one(arg1) :
print "arg1: %r" % arg1
# this one takes no argument
def print_none() :
print "I got nothin'."
print_two("Zed","Shaw")
print_two_again("Zed","Shaw")
print_one("First!")
print_none()
對不起,*其中*一段代碼?你在Python REPL中輸入了所有的東西嗎? – 2011-03-23 03:12:30
哪段代碼? – 2011-03-23 03:12:55
@senderle對此表示歉意!感謝您的支持! – 2011-04-13 03:00:13