This problem is usually caused by your Python file name being the same as the Python standard library module name, resulting in naming conflicts. Since the Python interpreter looks for the current directory and some other directories when loading a module, if your Python file name is the same as the standard library module name, the Python interpreter will load your Python file before the standard library module, resulting in naming conflicts.
For how to retrieve the code, you can try looking for your code file in the editor's "Open Recent Files" list. In VS Code, you can Open the Command panel by pressing Ctrl + Shift + P(Command + Shift + P on a Mac) and then type "Open Recent" to open the "Open Recent Files" list. Look for your code file in the list and double-click to open it.
If you can't find your code file, you may need to use a file recovery tool to recover the file. There are several commercial and free file recovery tools available, such as Recuva and TestDisk.
To avoid this problem, it is recommended that you avoid using file names with the same names as Python standard library modules when writing Python code, or save Python files to a separate folder to avoid naming conflicts.