37,741
社区成员
发帖
与我相关
我的任务
分享
>>> s = '[1,2],[3,4],[4,5]'
>>> v = eval('[%s]' % s)
>>> v
11: [[1, 2], [3, 4], [4, 5]]
>>> vstr = re.findall('\[([0-9,]*)\]', s)
>>> vstr
12: ['1,2', '3,4', '4,5']
>>> v = map(lambda x: map(int, x.split(',')), vstr)
>>> v
13: [[1, 2], [3, 4], [4, 5]]