python数字替换 携程校招

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/m0_37693335/article/details/82391133

 

正则表达式的方法

s = input()
import re
pattern = re.compile('\d*')
print(re.sub(pattern, "", s))

ASCII码的方法 

youhuicode = input()
res = ""
for i in youhuicode:
    if i >= 'A' and i <= 'z':
        res += i
print(res)

猜你喜欢

转载自blog.csdn.net/m0_37693335/article/details/82391133
今日推荐