with open('tiobe.txt', 'r', encoding='utf-8') as f:
a = f.read().replace('Date.UTC', '').replace('name : ', '').replace(',data : ', ':').split('\n')
dic = {}
for i in a:
dic.update(eval(i))
PL_name = input().lower()
year = int(input())
sum, num = 0, 0
for i in dic:
if i.lower() == PL_name:
for i2 in dic[i]:
if year in i2[0]:
print(i2)
sum += i2[1]
num += 1
break
if num != 0:
print(f'{PL_name}语言{year}年的tiobe平均值是{sum / num:.2f}')
else:
print(f'没有查到{PL_name}语言{year}年的tiobe数据')
Tiobe排行榜数据处理
于 2022-02-16 18:42:27 首次发布