msg = '/etc/a.txt|365|get' msg1 = msg.split('|') # 表示以|符为分隔符 print(type(msg1),msg1) # 得到一个列表
输出结果:
<class 'list'> ['/etc/a.txt', '365', 'get']