Using .translate() on a string to strip digits [Python 3]

后端 未结 2 789
心在旅途
心在旅途 2020-12-07 03:59

Let\'s say I have the string \'2okjser823ab\'. How can I remove all the numbers from the string using .translate()?

I see that in Python 2.x you can do something li

2条回答
  •  生来不讨喜
    2020-12-07 04:18

    You may use the strip function :

    strings="tycoon0123456789999"
    strings.strip("0123456789")
    

提交回复
热议问题