示例数据:
"PlayerId":169193,"PlayerName":"Alexandre Lacazette","PlaysOnHomeTeam":true,"OptaId":"p59966","GoalsConcededInBox":1,"ShotsInsideBox":8,"ShotsWoodwork":1,"TotalPasses":31,"PassSuccess":23,"KeyPasses":5,"DribblesAttempted":3,"DribblesWon":2,"AerialsWon":5,"AerialsLost":2,"TacklesSuccess":3,"TacklesAttempted":3
我想要的是一个包含在引号内的数据的列表,即 PlayerId 选手姓名 PlaysOnHomeTeam OptaId .. .. ..
任何人都可以告诉我正则表达式实现这个
答案 0 :(得分:3)
答案 1 :(得分:0)
如果您只想要每对的左手字符串:
import json
s = '{'+ '''"PlayerId":169193,"PlayerName":"Alexandre Lacazette","PlaysOnHomeTeam":true,"OptaId":"p59966","GoalsConcededInBox":1,"ShotsInsideBox":8,"ShotsWoodwork":1,"TotalPasses":31,"PassSuccess":23,"KeyPasses":5,"DribblesAttempted":3,"DribblesWon":2,"AerialsWon":5,"AerialsLost":2,"TacklesSuccess":3,"TacklesAttempted":3''' + '}'
list(json.loads(s))
输出:
['PlayerId', 'PlayerName', 'PlaysOnHomeTeam', 'OptaId', 'GoalsConcededInBox', 'ShotsInsideBox', 'ShotsWoodwork', 'TotalPasses', 'PassSuccess', 'KeyPasses', 'DribblesAttempted', 'DribblesWon', 'AerialsWon', 'AerialsLost', 'TacklesSuccess', 'TacklesAttempted']