How does Python handle the English question mark in the file path gracefully?

  1. error "Invalid argument" is reported when there is an English question mark in the path of the parameter file when using the open function of python
  2. asked on stackoverflow, and a boss told me, "Install linux.." Or something else that isn"t Windows. Alternatively, accept the fact that a file name can"t contain a question mark. (install linux. Or other systems that are not Windows. Or, accept the fact that the file name cannot contain a question mark.) "
  3. the current solution is to replace the English question mark with the Chinese question mark, but it doesn"t feel elegant enough. What if there are other characters that I don"t know that I"m not allowed to use? Do you have a better way to deal with it?

the code snippet that reports the error is as follows:

    savePath = "E:\\Desktop\\output\\?.html"
    file = open(savePath, "wb")

the error message is as follows:

Traceback (most recent call last):
  File "Main.py", line 35, in <module>
    crawler.testSaveContent("E:\\Desktop\\output\\?.html")
  File "E:\Desktop\MyCrawler.py", line 77, in testSaveContent
    file = open(savePath, "wb")
OSError: [Errno 22] Invalid argument: "E:\\Desktop\\output\\?.html"

python version: 3.6.3
operating system: win10

Mar.12,2021

operating system said that can not be used, can only be used, can only be changed, as for the file name does not allow the symbol list can go to the corresponding operating system documents, of course, generally search to have, as for Windows you can rename a file, and then enter the English question mark, will immediately prompt you which characters cannot be used for file naming.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3118d-2bd70.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3118d-2bd70.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?