来自字符串的阵列阵列的序列化数组
我需要从'[[“ a”,“ b”],[C',“ d”]]'
的字符串中进行一系列数组。
我尝试使用泡菜,但我并没有真正得到如何使用它。
我该如何应对这个字符串?
I need to deserialize an array of arrays from a string like '[["a", "b"], ["c", "d"]]'
.
I tried using pickle, but I didn't really get how to use it.
How can I deserialize this string?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试图书馆'json'
Try library 'json'
使用
ast.literal_eval()
:此输出:(
作为旁注,您应该使用
ast.literal_eval()
biveeval(eval)
e时出于安全原因,可以找到有关此的更多信息。 。Use
ast.literal_eval()
:This outputs:
(As a side note, you should use
ast.literal_eval()
overeval()
whenever possible, for security reasons. More information on this can be found here.eval()
can be extremely dangerous, and you should only use it unless you're aware of its risks.)