python数组字符串还原为数组
1 # coding=utf-8 2 s = '[[[0,0,0],[0,0,0],[0,0,0]],[[1,1,1],[1,1,1],[1,1,1]],[[2,2,2],[2,2,2],[2,2,2]]]' 3 print(s[0]) 4 x = eval(s) 5 print(x) 6 print(x[0])
结果:
posted on 2021-06-30 16:46 Keepshining 阅读(249) 评论(0) 编辑 收藏 举报
1 # coding=utf-8 2 s = '[[[0,0,0],[0,0,0],[0,0,0]],[[1,1,1],[1,1,1],[1,1,1]],[[2,2,2],[2,2,2],[2,2,2]]]' 3 print(s[0]) 4 x = eval(s) 5 print(x) 6 print(x[0])
结果:
posted on 2021-06-30 16:46 Keepshining 阅读(249) 评论(0) 编辑 收藏 举报