将列表转化成枚举类型示例:
li =[‘电脑‘,‘手机‘,‘电视‘]
for key,item in enumerate(li):
print(key,item)
i = input("please input index:")
index = int(i)
print(li[index])
时间: 2024-10-27 11:37:15
将列表转化成枚举类型示例:
li =[‘电脑‘,‘手机‘,‘电视‘]
for key,item in enumerate(li):
print(key,item)
i = input("please input index:")
index = int(i)
print(li[index])