首页 > 编程语言 >【Python】re 模块, 分割split字符串

【Python】re 模块, 分割split字符串

时间:2023-02-23 15:00:56浏览次数:35  
标签:End 1983 Python re split time 字符串

re split 分割字符串

line = 'Name: CAPTEX; Start time: 1983/09/18; End time: 1983/10/31; unit: pg/m3; Path:\datem\exp_data\captex\meas-t1.txt;'
list1 = re.split('[;:]', line.rstrip('\n'))
print(list1)  # ['Name', ' CAPTEX', ' Start time', ' 1983/09/18', ' End time', ' 1983/10/31', ' unit', ' pg/m3', ' Path:\\datem\\exp_data\\captex\\meas-t1.txt', '']

标签:End,1983,Python,re,split,time,字符串
From: https://www.cnblogs.com/jessecheng/p/17147964.html

相关文章