Python 字典 Dictionary keys()方法
Python 字典 Dictionary keys()方法
Python 字典(Dictionary) keys() 函數(shù)以列表返回一個(gè)字典所有的鍵。
語法
keys()方法語法:
dict.keys()
參數(shù)
- NA。
返回值
返回一個(gè)字典所有的鍵。
實(shí)例
以下實(shí)例展示了 keys()函數(shù)的使用方法:
#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.keys()
以上實(shí)例輸出結(jié)果為:
Value : ['Age', 'Name']
相關(guān)文章
- Python Number 數(shù)字
- Python2 與 Python3?? 版本區(qū)別
- Python 算法理由
- Python3 環(huán)境搭建
- Python3 基礎(chǔ)語法
- Python3 解釋器
- Python3 數(shù)字(Number)
- Python3 錯(cuò)誤和異常
- Python shuffle() 函數(shù)
- Python File tell() 方法
- Python os.close() 方法
- Python os.dup() 方法
- Python os.fchmod() 方法
- Python os.isatty() 方法
- Python os.open() 方法
- Python encode()方法
- Python isalnum()方法
- Python rfind()方法
- Python splitlines()方法
- Python List max()方法