str="I love Pekin, and you ?"
str_new=str.replace(' ','0')
str_new.split(",")
最后输出:['I0love0Pekin', '0and0you0?']
如果还想分开:
str_new_new=str_new.split(",")
str_new_new[0].split('0')+str_new_new[1].split('0')
最后输出:['I', 'love', 'Pekin', '', 'and', 'you', '?']
a = '1,2,,,4,,5'
[x if x else '0' for x in a.split(',')]
public class Fruit{ Fruit(){} } class Apple extends Fruit{ Apple(){ super(); } }
链议购邢鹊好说绦