Can python detect OS and then contruct a if/else statement for File System.
I would need to replace C:\CobaltRCX\ in Fn string with the FileSys string.
import os.path, csv
from time import strftime
if os.path.?????:## Windows
FileSys = r"C:\\working\\"
else: ##linux
FileSys = r"\\working\\"
y=(strftime("%y%m%d"))
Fn = (r"C:\\working\\Setup%s.csv" %y)
see here: https://stackoverflow.com/a/58689984/3752715
import platform
plt = platform.system()
if plt == "Windows": print("Your system is Windows")
elif plt == "Linux": print("Your system is Linux")
elif plt == "Darwin": print("Your system is MacOS")
else: print("Unidentified system")
you can see my github repo https://github.com/sk3pp3r/PyOS and use pyos.py script
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With