我正在尝试将日历制作程序放在一起,以便我可以更好地理解python字典。 我的小程序的发展阶段是表达以下伪代码蟒蛇: for i in number_of_dictionary_keys, j in range(j, 30):
change the value of number @ that key to j
所以我有一个Ordereddict对象: weekdays = { 'M
我试图更新的OrderedDict具有相同int值键的列表,像 for idx in indexes:
res_dict[idx] = value
其中value是int变量,indexes是的int s,这充当键list,res_dict是OrderedDict,试图解决上述在同一行, res_dict[indexes]=value
但得到的错误: TypeError: unh
所以我有一个高分文件是这样的: Markus:5000
Mike:3000
John:2400
我读给一个OrderdDict: high_scores = OrderedDict()
with open('highscores.txt') as file:
for line in file:
name, score = line.strip().split(':'