How to run script from interpreter?
Steven D'Aprano
steve at pearwood.info
Wed May 28 23:22:10 EDT 2014
On Wed, 28 May 2014 11:39:23 -0500, Mark H Harris wrote:
> On 5/28/14 2:44 AM, onlyvinish at gmail.com wrote:
>> On Friday, January 19, 2001 1:22:23 AM UTC+5:30, Rolander, Dan wrote:
>>> What is the best way to run a python script from within the
.................................^^^^^^^^
>>> interpreter? What command should I use?
>>>
>>>
>> try using execfile(filename)
>>
>>
> What type of script? python? bash? tcl? other?
Most Python scripts are Python. The remainder are usually Python.
> If you want to use python as a shell-glue you can try using system.
>
> >>> from os import system
> >>> def <function_name>([parms])
> >>> .... blah blah
> >>> .... rc = system("<your_script_name")
os.system is cool for quick and dirty calls to an external command. But
for serious work, the subprocess module is better.
--
Steven
More information about the Python-list
mailing list