小白学习python
1.首先要把当前的目录D:\pythonScripts 加入到 python的 path 中。
2. 要在当前目录写一个 bat的文件。例如:
@py.exe d:\pythonScripts\pw.py %*
@pause
保存为py.bat
3.在py.py的程序内:
#! python3
# py.py
import sys
print(sys.argv[1])
if len(sys.argv) > 1:
print(''.join(sys.argv[1:]))
![点击并拖拽以移动 wAAACH5BAEKAAAALAAAAAABAAEAAAICRAEAOw==](https://i-blog.csdnimg.cn/blog_migrate/754c8176f67847da6fac5fbaa76b7dd7.png)
4. 在命令行运行
py 123
得到 : 123
py hello world
得到 hello world