1. 程式人生 > >10 字典中enumerate() 的用法

10 字典中enumerate() 的用法

pytho rain lex cal 字典 rest num strip appdata

li = {"alex"," aric","Alex","Tony","rain"}
for i,j in enumerate(li,1):
new_j = j.strip()
print(i,new_j)

RESTART: C:/Users/wssar/AppData/Local/Programs/Python/Python37-32/1002q3.py
1 alex
2 Tony
3 Alex
4 aric
5 rain
>>>

10 字典中enumerate() 的用法