我需要一个由很多键组成的字典,并且值必须是包含很多字符串的列表。(Python)
我试过:
d1[key].append(value)
Run Code Online (Sandbox Code Playgroud)
但Python说:
AttributeError: 'str' object has no attribute 'append'.
Run Code Online (Sandbox Code Playgroud)
我需要类似的东西:{a:[b,c,d,e],b:[t,r,s,z]....}
我能做什么?
提前致谢。
我有一个由Python中的字符串和列表组成的字典.
{'stringhere':[a1,a2,a3], 'anotherstringhere':[a2,a4,a5],....}
Run Code Online (Sandbox Code Playgroud)
问题是,某些字符串被写为特殊字符,因为重音,例如,'ol\xe9'
而不是'olé'
.
是否可以在orded中更改这些字符串以实现expected('olé'
)结果?提前致谢.