Handling path slash character for Windows and Linux compatibility Windows uses “\\”Linux uses “/” Although using the Linux forwardslash will often work on Windows too, its a bit hacky and isn’t guaranteed to work. For correct Python code you should use the pathlib to solve it Detecting Windows or Linux for OS file system dependant […]
Category: File Input and Output
Read File
Read a line from a text file example
Working With Files
We use pathlib and forward slashes so that the Path() function can be used to automatically convert backslash to forward slash on Linux systems. Does file exist? Getting file name elements Delete file
Working With Directories
We use pathlib and forward slashes so that the Path() function can be used to automatically convert backslash to forward slash on Linux systems. Does directory exist? Create Directory
Write File
Write text file Write binary file