简体   繁体   English

如何仅从python的开头和结尾删除引号

[英]how to remove quotes only from start and end in python

'{"userId":"NiouCzjBYnax3UST5tDc2","file_Name":["abc.PNG","cdf.PNG","cbc.PNG","shs.PNG"],"url":["images/NiouCx3UST5tDc2/2020-01-23/sas.PNG","images/Niox3UST5tDc2/2020-01-23/R-CC.PNG","images/NiouCzjBYna8WST5tDc2/2020-01-23/sas.PNG","images/NiouCzj3UST5tDc2/2020-01-23/jka.PNG"]}'

The outer quotes make that a string.外部引号使其成为字符串。 Removing characters from a string still returns a string...从字符串中删除字符仍然返回一个字符串...

If I understand correctly, you should parse the string如果我理解正确,您应该解析字符串

import json
data = json.loads(string) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM