您好,登錄后才能下訂單哦!
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]) f={"client":"John","sketch":"cheese"} cheeseshop("Limburger","aaaaaaa","bbbbbbbbbb",**f)
cheeseshop("Limburger","aaaaaaa","bbbbbbbbbb",client="John",sketch="cheese")
功能一樣,可見**args 時應為字典類型,或是關鍵字類型的參數。
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。