import res = "H2 + O2 = 2H2O"print (re.split("\W+", s))# re.split takes a regular expression on which you can split the string.# \W represents non-word character. For ASCII, word characters are [a-zA-Z0-9_]# + represents one or more occurrences.在您的示例中,它将字符串从' + '和' = '