可以说我有这个代码:
def dosomething(thing1, thing2=hello, thing3=world):
print thing1
print thing2
print thing3
我希望能够指定thing3 是什么,但不必说thing2 是什么。(下面的代码是我认为它可能工作的方式......)
dosomething("This says 'hello fail!'", , 'fail!')
它会说
This says 'hello fail!'
hello
fail!
那么有没有办法做到这一点,或者thing2
每次我想说什么时我都必须指定thing3
?
我正在使用 python2,如果这很重要。