code:

str = 'string-123-test'

str1 = str.split('-')

print('str1: ' ,str1)

 

output:

str1: ['string', '123', 'test']

 

 

 

arrow
arrow
    文章標籤
    python string split
    全站熱搜

    楓綺 發表在 痞客邦 留言(0) 人氣()