value = re.findall(b,'some regex',respdata)
keywords = re.findall(b,'some regex',respdata)
#Empty dictionary
Dictionary = {}
x=0
for eachValue in value:
Dictionary[eachValue] = keyword[x]
x+=1
print(Dictionary)
在这之后,我想用JSON对字典进行编码“值:关键字“格式,有什么建议吗?提前谢谢你
Tags:
只需使用stdlib:
另外,请确保在变量命名时遵循PEP约定,我认为字典变量的大写是违反的,请参见:https://www.python.org/dev/peps/pep-0008/#prescriptive-naming-conventions
Python有一个模块
json
:相关问题 更多 >
编程相关推荐