devwiki:python

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revisionBoth sides next revision
devwiki:python [2024/01/11 02:32] – [file operation] yingdevwiki:python [2024/03/21 08:53] – [Online Python run] ying
Line 1: Line 1:
 +
 +
 +====== Modern Python Practice ======
 +
 +  * nowaday, now one use python 2.x anymore, use python 3 standard, use this
 +    * use pathlib instead of os.path
 +    * use f"{keyword}" instead of "{0}".format(keyword), unless it is easier
  
  
Line 938: Line 945:
     pass     pass
          
-# method 3: all in one check and create if needed+# method 3: all in one check and create if needed, like method 2 but not need try and except since it will be ok for exist
 os.makedirs(os.path.dirname(output_path), exist_ok=True) os.makedirs(os.path.dirname(output_path), exist_ok=True)
 </code> </code>
  • devwiki/python.txt
  • Last modified: 2024/03/25 06:36
  • by ying