我有一個(gè)列表,它在字符串中包含“,”并且也是分隔符。當(dāng)我使用.split(",") 字符串被拆分為每個(gè)","。有沒(méi)有辦法解決這個(gè)問(wèn)題,我可以保留“,”并仍然使用它作為分隔符樣本:string = "hello","this is from melbourne, australia"
print(string.split(","))結(jié)果: ["hello","this is from melbourne", "australia"]我想要的是:["hello", "this is from melbourne, australia"]
使用相同的分隔符在 python 中拆分字符串
桃花長(zhǎng)相依
2021-09-14 15:45:52