【python】千年虫是什么虫

已知一个列表中存储员工的出生年份[99,89,90,98,00,99],现需要将2位年份变为4位年份

lst=[88,89,90,98,00,99]
print(lst)		# 00年只保留了一个0,所以需要添加200
#遍历列表
for index in range(len(lst)):
	if str(lst[index])!='0':
		lst[index]='19'+str(lst[index])
	else:
		lst[index]='200'+str(lst[index])
```python
lst=[88,89,90,98,00,99]
print(lst)		# 00年只保留了一个0,所以需要添加200
# 使用enumerate()函数
for index,value in enumerate(lst):
	if str(value)!='0':
		lst[index]='19'+str(value)
	else:
		lst[index]='200'+str(value)

你可能感兴趣的:(python,前端,javascript)