我有一根绳子
'Predicate(big,small)'
['Predicate','(','big',',','small',')']
名字可以是任何东西,元素之间也可以有空格,比如so(我需要从列表中去掉空格),
Predicate (big, small)
到目前为止我已经试过了,但这显然不是我想要的结果
>>> str1 = 'Predicate(big,small)'
>>> list(map(str,str1))
输出:
['P', 'r', 'e', 'd', 'i', 'c', 'a', 't', 'e', '(', 'b', 'i', 'g', ',', 's', 'm', 'a', 'l', 'l', ')']