2
파이썬 목록에 문자열을 변환 :파이썬 -이처럼 내 데이터가 포함 된 문자열이
result = "[
{'service': {'option1': 'abc', 'others': 'blah blah'}},
{'service': {'option2': 'None', 'others': 'None'}}
]\n
[
{'rules': {'permissions': 'allow', 'opp': 'evening', 'order': '10', 'self': 'me'}},
{'rules': {'permissions': 'not allowed', 'opp': 'None\\n', 'order': 'None', 'self': 'None'}}
]"
내가 좋아하는 적절한 목록으로 변환 할 :
result = [[
{'service': {'option1': 'abc', 'others': 'blah blah'}},
{'service': {'option2': 'None', 'others': 'None'}}
],
[
{'rules': {'permissions': 'allow', 'opp': 'evening', 'order': '10', 'self': 'me'}},
{'rules': {'permissions': 'not allowed', 'opp': 'None\\n', 'order': 'None', 'self': 'None'}}
]]
은 친절하게 도움을 나 밖으로! .split()
, .join()
을 시도했지만 위와 같은 정확한 형식을 얻을 수 없습니다.