【正则表达式应用】不规则多维数组展平一维
作者:互联网
l = [[1, 2], [3, 4], [5, [6, 7, [8, 9]]], 10, [11, [12, 13, [14, 15, [16]]]]]
eval(re.sub("(?!^)\[|\](?!$)", "", str(l))) # 小小明
[int(i) for i in re.findall('\d+',str(l))] # 原创
原文:
https://blog.csdn.net/as604049322/article/details/112387064
标签:re,正则表达式,展平,int,csdn,str,多维,findall 来源: https://www.cnblogs.com/hightech/p/16343599.html