我正在使用Python 2.7.3并试图理解为什么这个脚本不按顺序执行print语句.即" - "打印在第二个for循环之后.
我的剧本:
def cheeseshop(kind, *arguments, **keywords):
print "-- Do you have any", kind, "?"
print "-- I'm sorry, we're all out of", kind
for arg in arguments:
print arg
print "-" * 40
keys = sorted(keywords.keys())
for kw in keys:
print kw, ":", keywords[kw]
cheeseshop("Limburger", "It's very runny, sir.",
"It's really very, VERY runny, sir.",
{'shopkeeper':'Michael Palin',
'client':"John Cleese",
'sketch':"Cheese Shop Sketch"})
Run Code Online (Sandbox Code Playgroud)
输出:
-- Do you have any Limburger ?
-- I'm sorry, we're all out of …Run Code Online (Sandbox Code Playgroud)