[英]Running a single Python script with different parameter values
I have a Python script called a.py
, which takes 1 parameter from the command line. 我有一个名为a.py
的Python脚本,该脚本a.py
获取1个参数。 a.py
is invoked as follows: python a.py 1
, where 1
is the parameter value. a.py
的调用方式如下: python a.py 1
,其中1
是参数值。 Now, suppose I run a.py
with 3 different parameter values on a single machine like this: 现在,假设我在单台机器上使用以下3个不同的参数值运行a.py
:
python a.py 1 &
python a.py 2 &
python a.py 3
I only see one a.pyc
file. 我只看到一个a.pyc
文件。 I wonder why there is only one a.pyc
file since I invoke the program 3 times with 3 different parameters values, should there be 3 a.pyc
files (maybe with different names)? 我想知道为什么只有一个a.pyc
文件,因为我用3个不同的参数值调用了3次程序,是否应该有3个a.pyc
文件(也许使用不同的名称)? If not, the a.pyc
file couldn't contain all 3 parameters values, so where are the parameter values (ie, 1,2,3
) stored? 如果不是,则a.pyc
文件不能包含所有3个参数值,那么参数值(即1,2,3
)存储在哪里?
please refer this Difference py and pyc 请参考这个区别py和pyc
Basically parameters you are passing is just a system argument. 基本上,您要传递的参数只是一个系统参数。 When Py file is get compiled it converted into Byte Code, Where System argument is just a input parameter from command line so there will be single Pyc file for the same code base. 当编译Py文件时,它将转换为字节码,其中System参数只是命令行中的输入参数,因此对于相同的代码库,将只有一个Pyc文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.