python hello.py hello_msg("Hello no", 3)??? Help, please!
Chris
chris at suse.local
Fri May 21 13:48:05 EDT 2004
Peter Hansen wrote:
> Carl wrote:
>
>> This is perhaps a very simple and stupid question!
>>
>> How do you run a specific function (with actual values for the
>> parameters) within a module from the command prompt? That is, with
>> "python ..."
>>
>> For instance, how do I run hello_msg("Hello no ", 3), which is a function
>> within the module hello.py, from the console?
>>
>> def hello_msg(msg, num):
>> print msg + str(num ** 3) +'!'
>> #hello_msg("Hello no ", 3)
>
> Use the -c option.
>
> python -c "import modulename; modulename.hello_msg('test', 5)"
Or, from the command prompt, 'import modulename'
More information about the Python-list
mailing list