Given the python code:
import sys
import os
def MyPythonMethod(value1, value2):
# defining some variables
a = 4
myValue = 15.65
listValues = [4, 67, 83, -23]
# check if a file exists
if ( os.path.exists('/home/hello/myfile.txt') ):
pass
# doing some operation on the list
listValues[0] = listValues[1]
# check if a file exists
print sys.path
# looping through the values
for i in listValues:
print i
How can I extract the names of all external methods in function MyPythonMethod?
Ideally, I'd like to get a list of all external methods/members that are being invoked.
For MyPythonMethod, this will return:
moduleNames = ["os", "sys"]
methodsInvoked = ["os.path.exists", "sys.path"]
(yes, I know that 'path' is a member of sys, not a method; but I think you get the idea).
Any ideas?
["os.path.exists", "sys.path"]. How will you solution help in doing so?