Str对象不可调用

Or *_*imi 1 python string dictionary

我试图寻找一种将字符串拆分为字典的方法.

a=(get_profile_data()['1'])
print(a)
# output: CSRP:Hot12345,Pos:[id],Erp:Hot123456,Miki:[id],Citrix:Hot12345
Run Code Online (Sandbox Code Playgroud)

我出来了这个解决方案:

b= dict(e.split(':') for e in a.split(','))
Run Code Online (Sandbox Code Playgroud)

但我得到错误Str object is not callable.我不明白为什么错误提出来,我会感激任何帮助.谢谢,或者

编辑:完全引用:跟踪:C:\或\ myScript\txt creator\line_reader.py.第24行
TypeError:'str'对象不可调用.

奇怪的是代码在空闲时运行良好,但在PyScripter中向我显示此错误.

Thi*_*ter 7

听起来像是在dict某处用字符串覆盖.解决这个问题,它会起作用.

由于它显然是由您的环境破坏引起的,因此您可以使用此解决方法来恢复它:

dict = type({})
Run Code Online (Sandbox Code Playgroud)