python 方法
?
簡(jiǎn)單方法聲明及調(diào)用
1 def hello(name='world', id=0): 2 return "hello %s %s" % (name, id) 3 4 5 str = hello('kimi', 3)
可變參數(shù)
?
字典參數(shù)
1 #字典需要聲明及使用時(shí) 2個(gè)參數(shù) ** 2 def t(**args): 3 print(args) 4 5 6 t(**{'a': 1, 'b': 2}) 7 8 #輸出為 9 {'a': 1, 'b': 2}?
轉(zhuǎn)載于:https://www.cnblogs.com/xiaopythoner/p/3469094.html
總結(jié)
- 上一篇: Android 向服务器发送XML数据及
- 下一篇: python对列表的删除,挺有意思的东西