Running scripts from shell / IDLE in windows

Mark H Harris harrismh777 at gmail.com
Thu May 1 12:18:28 EDT 2014


On 5/1/14 11:02 AM, Mark H Harris wrote:
> ====file hello.py===
>
> def Hello(parms list):
>      whatever
>      whatever
>
> ====================
>
>
>  From IDLE:
>
> import hello
>
> hello.Hello([1, 2, 3, 4])

Sorry, almost forgot, if you 'run' the module hello.py (with the IDLE 
run dropdown) then the 'hello' name will not be in the namespace... just 
enter:

Hello(parms)

Here is another example:

===hello.py===

def Hello(myname):
     out = "hello, " + str(myname)
     print(out)

==============


import hello
hello.Hello("mark")

hello, mark






More information about the Python-list mailing list