"Stupid methodology Python3" 17. More file operations

Script:
Here Insert Picture Description
Run:
Here Insert Picture Description
Notes:

  1. There is no process to create the file, because I create a file using the echo in powershell in after, and then run Python will prompt an error.
    Here Insert Picture Description
    This error is because the encoding format file is not UTF-8, I use notepad ++ to write, it is necessary to select a coding toolbar, and then choose to use UTF-8 encoding enough.
  2. Exits judge whether a file exists, if there is, returns True, does not exist, it returns False.
  3. len () Returns a string length as a numerical value.

Guess you like

Origin blog.csdn.net/weixin_45069175/article/details/93206915