Feb-16-2019, 04:34 PM
Basically I need to call the function recursively.
Below is my code
so here I need to call the same function by passing the input as drive and then next exporter and so on.
if drive or exporter and so on gives output as anyother repos, then we need to run the same function for that repos as well until we get nothing.
the above code fits for only one iteration but it doesn't fit for recursion. How can I implement recursion call in the above code.
Below is my code
path="/home/" url = "<url>" nme = {'xmlns' : url} def find( repo, dep ): pom=path+repo+"/pom.xml" if not os.path.exists(pom): return tree = ElementTree.parse(pom) root = tree.getroot() deps = root.findall(".//xmlns:dependent", nme=nme) for d in deps: aid = d.find("xmlns:aid", nme=nme) vsn = d.find("xmlns:vsn", nme=nme) if dep == aid.text: print repo + " : " + vsn.text file_change(repo) return print "\ndependecy:\n" rps=os.walk(path).next()[1] for repo in rps: find(repo, dep) print "\n"when I run the above script by passing parameter as util, It gives the output as drive, exporter, handler and so on and I am calling file_change function in each iteration to update the xml file
so here I need to call the same function by passing the input as drive and then next exporter and so on.
if drive or exporter and so on gives output as anyother repos, then we need to run the same function for that repos as well until we get nothing.
the above code fits for only one iteration but it doesn't fit for recursion. How can I implement recursion call in the above code.