Python auto save file failed

Updated on technology 2024-04-08
10 answers
  1. Anonymous users2024-02-07

    **Should be fine, need to make sure the target dir exists. If the run fails, the zip should also have an output that can be posted together.

    Here are my test results (for testing, the directory is different, and the target dir is used to ensure that the target dir exists), test platform win7 cygwin:

    import os

    import time

    source = ['d:/hello-git'I know this is the file to copy.

    target_dir = 'd:/tmp/tmp'The place to save the file.

    Make sure the directory exists.

    target = target_dir + '%y%m%d%h%m%s') +'.zip'The name and format of the file.

    zip_command = "zip -r ". format(target, ' '.join(source))

    print(zip_command)

    if == 0:

    print('successful backup to', target)

    else:print('backup failed')

    Output: zip -r d: tmp tmp d: hello-git

    adding: hello-git/ (452 bytes security) (stored 0%)

    adding: hello-git/readme (408 bytes security) (stored 0%)

    adding: hello-git/ (284 bytes security) (stored 0%)

    adding: hello-git/ (408 bytes security) (deflated 9%)

    adding: hello-git/ (284 bytes security) (deflated 28%)

    adding: hello-git/ (284 bytes security) (deflated 38%)

    successful backup to d:/tmp/tmp/

  2. Anonymous users2024-02-06

    Don't try the Chinese path.

  3. Anonymous users2024-02-05

    The python file is saved as follows:

    1. First of all, click in the win10 start menu to run idle.

    2. Then, you can see that it is in test mode when it is just opened, and you can test it at will.

    3. If you want a more formal python file, click file-new file. Or press the shortcut Ctrl N to create a new file for IDLE.

    4. Then, the window can be python**. The default name is untitled, so press ctrl s to save. The default is the pythonfile type when saving.

    6. Next, click run-run module to run, and the shortcut key is F5.

    7. Finally, in the previous shell window, you will see the running result of the file, as well as the path of the file.

  4. Anonymous users2024-02-04

    I just did this.,Later, I changed the file name.,Before, it may have been with unsupported characters in the name.,I don't know if you're like that.。

  5. Anonymous users2024-02-03

    I've also encountered this problem.,Now it's solved.,I made a mistake.,Can't save.,You can save it after you change it.。

  6. Anonymous users2024-02-02

    In the traditional preservation method, create a new text to write and then save.

  7. Anonymous users2024-02-01

    3. If you want a more formal python file, you need to create a new one, and "ctrl n" is the new file of idle.

    4. After that, there will be an additional window, which is different from the first window opened, and this window can be python**. The default is untitled, so you need to ctrl s to save it, and the default is the pythonfile type.

    5. After saving, you can write the regular python**, and you can use print to test it directly.

    6. Then it's running, here it should be used as a module to run to be effective, and the shortcut key is F5.

    7. Then in the previous shell window, you will see the running result of the file, as well as the path prompt of the file.

  8. Anonymous users2024-01-31

    Python is saved in py format under Windows, and it can be executed by clicking on it.

    If you are on Linux, you can do without the suffix.

  9. Anonymous users2024-01-30

    Write the suffix on it, and write it when you save it.

  10. Anonymous users2024-01-29

    Change the suffix to. py is fine.

Related questions
7 answers2024-04-08

I will answer the above questions for you. Taking Word as an example, the way to recover a file that you forgot to save is: 1. First, click on the file in the upper left corner of the Word software, and a drop-down menu will pop up. >>>More

10 answers2024-04-08

The computers in the office have always been installed with the Windows operating system, and because the driver often uses the computer at will when he is fine, the resolution parameters of the display are often adjusted to 640x480, so that the display cannot realistically display images or other content. Recently, when the author tried to adjust the resolution of the monitor to800x600, and adjust the "color quality" to 32-bit true color, and then restart the computer system, the author saw that the display turned all into a black screen; Although, when the author restored the resolution of the monitor to the previous 640x480 again, the black screen of the monitor no longer happened. But what makes the author always wonder is,Isn't the display able to work normally in the 800x600 resolution state? >>>More

4 answers2024-04-08

Also for the record.

Paper archives can be archived and collected, and can be found and viewed later when needed. It is specific and can be handed over directly to a second person, and if sealing measures are added, its secrecy is stronger. As long as he doesn't fall into the hands of others. >>>More

14 answers2024-04-08

You need to compress the wtf folder and cache folder of the wow file and send it to the mailbox or network hard drive, go to a different machine each time, unzip it, and then overwrite it. >>>More

5 answers2024-04-08

You look for the software in the addition and deletion program, if there is, delete him, there is no recommended tool to uninstall, as for retrieving files, it is recommended to see if the files are hidden, if they are indeed deleted, then ** hard disk data recovery software to try. >>>More