简体   繁体   English

Python:从第一个数字字符删除字符串

[英]Python: deleting string from first numeric character

How could I delete/split the string below from the first numeric character? 如何从第一个数字字符中删除/分割下面的字符串?

Good 11 hdle 好11 h

would become 会成为

Good

the only things I can seem to find are removing numbers OR letters from the whole string 我似乎唯一能找到的就是从整个字符串中删除数字或字母

import re
str = "some text 12345 other text"
result = re.split("\d+", str)[0]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM