python使用正则表达式删除字符串中的其它字符只保留数字和字母
#python使用正则表达式删除字符串中的其它字符只保留数字和字母
# Python code to demonstrate# to remove all the characters# except numbers and alphabetsimport re# initialising stringini_string = "123abcjw:, .@! eiw"# printing initial stringprint ("initial string : ", ini_string)# function to demonstrate removal of characters# which are not numbers and alphabets using reresult = re.sub([\W_]+
如果觉得《python使用正则表达式删除字符串中的其它字符只保留数字和字母》对你有帮助,请点赞、收藏,并留下你的观点哦!