Python Forum
call a function from other functions ...
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
call a function from other functions ...
#1
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 :

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 ?
Reply


Messages In This Thread
call a function from other functions ... - by evilcode1 - Sep-05-2018, 08:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How do I call sys.argv list inside a function, from the CLI? billykid999 3 752 May-02-2023, 08:40 AM
Last Post: Gribouillis
  how to call an object in another function in Maya bstout 0 2,042 Apr-05-2021, 07:12 PM
Last Post: bstout
  Combine Two Recursive Functions To Create One Recursive Selection Sort Function Jeremy7 12 7,192 Jan-17-2021, 03:02 AM
Last Post: Jeremy7
  How to call multiple functions sequentially Mayo 2 9,157 Jan-06-2021, 07:37 PM
Last Post: Mayo
  In this function y initially has no value, but a call to foo() gives no error. Why? Pedroski55 8 3,415 Dec-19-2020, 07:30 AM
Last Post: ndc85430
  Struggling for the past hour to define function and call it back godlyredwall 2 2,156 Oct-29-2020, 02:45 PM
Last Post: deanhystad
  list call problem in generator function using iteration and recursive calls postta 1 1,862 Oct-24-2020, 09:33 PM
Last Post: bowlofred
  function call at defined system time? Holon 5 3,154 Oct-06-2020, 03:58 PM
Last Post: snippsat
  How to call/read function for all elements in my list in python johnny_sav1992 1 2,038 Jul-27-2020, 04:19 PM
Last Post: buran
  module to store functions/variables and how to call them? mstichler 3 2,338 Jun-03-2020, 06:49 PM
Last Post: mstichler

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020