文字列から文字と空白を削除しようとしていますが\r\n
、結果に表示されないようになっています。また、私が与えた正規表現を除いた結果を返す関数はありますか?
除外する必要がある私のコード\r\n
region = ",,,Central California\r\n"
#\w Matches word characters.
#\s Matches whitespace
print re.findall(r"[\w\s]+", region)
除外された出力['Central California']
出力を取得しました['Central California\r\n']
正規表現に一致しないものをすべて返します
region = ",,,Central California\r\n"
#\W Matches nonword characters.
print re.exclude_function(r"[\W]+", region)
除外された出力['Central California']