If Python contains even one of the Windows file name unknown characters \:/ * ? " < > | I want to replace those characters with spaces.
I don't know how to write a regular expression to include everything.
Please answer
You can just put in the characters you want to replace by |.
before_str = "a?a:aa<sdfsdf>" after_str = re.sub("[?|<|>|?|:]", " ", before_str) print(after_str) a a aa sdfsdf
590 Scrap text information after the "View More" button when searching in the Yahoo! News search window
574 Who developed the "avformat-59.dll" that comes with FFmpeg?
581 PHP ssh2_scp_send fails to send files as intended
618 Uncaught (inpromise) Error on Electron: An object could not be cloned
572 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.