Sep-05-2018, 08:14 AM
hello all ...
im writing a code to check the system if it linux or windows and do so if expressions after checking the system ....
this is my code :
how i can do that ?
im writing a code to check the system if it linux or windows and do so if expressions after checking the system ....
this is my code :
import os import sys import zipfile q = os.getenv("APPDATA") d = os.getenv("userprofile") def systemtype(): lo = sys.platform if lo == "win32": print(lo) elif lo == "linux2": pass systemtype() def unzipfiles(): if os.path.isdir(q+"/d"): pass else: zip_ref = zipfile.ZipFile(q + "\d.zip", 'r') zip_ref.extractall(q) print(os.getcwd()) unzipfiles()i need to call the function systemtype() from the unzipfiles() if the system = windows then extract all files from d.zip to C:\Users\root\AppData\Roaming\d ... if the system is linux extract all files from d.zip to /tmp ....
how i can do that ?