How can we strip punctuation at the start of a string using Python?

前端 未结 7 678
悲哀的现实
悲哀的现实 2021-01-14 11:43

I want to strip all kinds of punctuation at the start of the string using Python. My list contains strings and some of them starting with some kind of punct

7条回答
  •  花落未央
    2021-01-14 11:51

    for each_string in list:
        each_string.lstrip(',./";:') #you can put all kinds of characters that you want to ignore.
    

提交回复
热议问题