Can a function be called within a function ?

Kent Johnson kent37 at tds.net
Mon Apr 18 08:25:24 EDT 2005


Peter Moscatt wrote:
> Is it possible to write code and allow a function to be called within
> another like I have shown below ?

Yes, of course. In fact you do it six times in the code below, to call open(), readline(), append(), 
close(), main() and populatelist().

Kent

> 
> Pete
> 
> 
> 
> def populatelist():
>         f=open(_globals.appath + "dxcluster.svr","r")
>         while true:
>                 text = f.readline()
>                 if text =="":
>                         break
>                 _list.append(string.strip(text))        
>         f.close()
>         
>         
> def serversettings():
>         servers.main(root)
>         if _globals.refresh=="yes":
>                 populatelist()   <----------------------- calling function above.
> 
> 



More information about the Python-list mailing list