|
|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
win 10
python 3.6.2
代码如下:
import sys
print('The command line arguments are:')
for i in sys.argv:
print(i)
print('\n\nThe PYTHONPATH is', sys.path, '\n')
书上运行结果:
$ python module_using_sys.py we are arguments
The command line arguments are:
module_using_sys.py
we
are
arguments
The PYTHONPATH is ['/tmp/py',
# many entries here, not shown here
'/Library/Python/2.7/site-packages',
'/usr/local/lib/python2.7/site-packages']
我的运行结果:
The command line arguments are:
E:/Python3.6.2/书本程序/module_using_sys.py
The PYTHONPATH is ['E:/Python3.6.2/书本程序', 'E:\\Python3.6.2\\Lib\\idlelib', 'E:\\Python3.6.2\\python36.zip', 'E:\\Python3.6.2\\DLLs', 'E:\\Python3.6.2\\lib', 'E:\\Python3.6.2', 'E:\\Python3.6.2\\lib\\site-packages', 'E:\\Python3.6.2\\lib\\site-packages\\easygui-0.98.0_unreleased-py3.6.egg', 'E:\\Python3.6.2\\lib\\site-packages\\win32', 'E:\\Python3.6.2\\lib\\site-packages\\win32\\lib', 'E:\\Python3.6.2\\lib\\site-packages\\Pythonwin']
请问,为什么我没有we are arguments这几个单词,以及为什么我的地址没有换行呢?
1.这里得到的是命令行参数,如果没有输入自然就没有。
2.打印列表不会按元素换行的,例子中只是为了好看,且# many entries here, not shown here说明有些并没有显示出来。
在idle中没有给参数:
在命令行窗口,给力参数:
|
|