新聞中心
這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)Python教程:python關(guān)鍵字參數(shù)的多種使用
1、使用關(guān)鍵字時甚至可以打亂參數(shù)傳遞次序。

overspeed_rate(min=80, max=100, current=100) >>> overspeed_rate(min=80, max=100, current=100) 0
2、在定義函數(shù)時,如果參數(shù)列表中的某個參數(shù)使用**參數(shù)名稱,則該參數(shù)可以接受所有關(guān)鍵詞參數(shù)。
def echo(string, **keywords): print(string) for kw in keywords: print(kw, ":", keywords[kw]) >>> echo(‘hello’, today=‘2019-09-04’, content=‘function’, section=3.6)
以上就是python關(guān)鍵字參數(shù)的多種使用,希望對大家有所幫助。更多Python學習指路:創(chuàng)新互聯(lián)Python教程
本文教程操作環(huán)境:windows7系統(tǒng)、Python 3.9.1,DELL G3電腦。
分享文章:創(chuàng)新互聯(lián)Python教程:python關(guān)鍵字參數(shù)的多種使用
當前地址:http://www.dlmjj.cn/article/cdhcspi.html


咨詢
建站咨詢
