Python论坛  - 讨论区

标题:[python-chinese] 大家好,在启动一个python程序的时候,怎么传递参数进去呢?

2007年07月09日 星期一 17:53

Joe Simer simerjoe在gmail.com
星期一 七月 9 17:53:26 HKT 2007

ÈçÌâ:
python myprogram.py parameter

ÎÒÔõôÔÚ³ÌÐòÀïÃæ½ÓÊÕ parameter ÄØ?
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070709/ada6200a/attachment-0001.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月09日 星期一 18:00

大熊 bearsprite在gmail.com
星期一 七月 9 18:00:37 HKT 2007

sys.*argv*

在07-7-9,Joe Simer <simerjoe在gmail.com> 写道:
>
> 如题:
> python myprogram.py parameter
>
> 我怎么在程序里面接收 parameter 呢?
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
茫茫人海,你是我的最爱
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20070709/2c440688/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月09日 星期一 18:00

Samuel Chi princeofdatamining在gmail.com
星期一 七月 9 18:00:38 HKT 2007

python source.py arg0 arg1 arg2 arg3
³ÌÐòÀïÃæ
import sys
print(sys.argv)

ÔÚ07-7-9£¬Joe Simer <simerjoe在gmail.com> дµÀ£º
>
> ÈçÌâ:
> python myprogram.py parameter
>
> ÎÒÔõôÔÚ³ÌÐòÀïÃæ½ÓÊÕ parameter ÄØ?
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070709/6d1a8f25/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月09日 星期一 18:06

赵威 zhaoweikid在163.com
星期一 七月 9 18:06:21 HKT 2007

Joe Simer£¬ÄúºÃ£¡ 

¡¡¡¡ÊÇÄã°¡£¬¹þ¹þ¡£
http://www.pythonid.com/bbs/viewthread.php?tid=22&extra;=page%3D1

======== 2007-07-09 17:53:26 ÄúÔÚÀ´ÐÅÖÐдµÀ£º ========

ÈçÌâ:
python myprogram.py parameter

ÎÒÔõôÔÚ³ÌÐòÀïÃæ½ÓÊÕ parameter ÄØ?

= = = = = = = = = = = = = = = = = = = = = = 
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÖÂ
Àñ£¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÕÔÍþ
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡zhaoweikid在163.com
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡2007-07-09
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070709/a7fb9272/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月09日 星期一 18:08

Alex Cheng chengxin1985在gmail.com
星期一 七月 9 18:08:47 HKT 2007

¶ÔÓÚ¸´ÔӵIJÎÊý£¬ÎÒ¾õµÃÓ¦¸ÃÓà optparse Ä£¿é±È½ÏºÃ¡£ÓÃËü¿ÉÒÔ×÷³ö±ê×¼µÄunix ÃüÁîÐй¤¾ß¡£
Ïêϸ֪ʶÇë¿´£º
http://docs.python.org/lib/module-optparse.html


ÔÚ07-7-9£¬ÕÔÍþ <zhaoweikid在163.com> дµÀ£º
>
> Joe Simer£¬ÄúºÃ£¡
>  ÊÇÄã°¡£¬¹þ¹þ¡£
> http://www.pythonid.com/bbs/viewthread.php?tid=22&extra;=page%3D1
>
> ======== 2007-07-09 17:53:26 ÄúÔÚÀ´ÐÅÖÐдµÀ£º ========
>
>
> ÈçÌâ:
> python myprogram.py parameter
>
> ÎÒÔõôÔÚ³ÌÐòÀïÃæ½ÓÊÕ parameter ÄØ?
>
>  = = = = = = = = = = = = = = = = = = = = = =
>
> ÖÂ
> Àñ£¡
>
>  ÕÔÍþ
>  zhaoweikid在163.com
>  2007-07-09
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
powered by python
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070709/b476a6fd/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月09日 星期一 18:18

Zoom.Quiet zoom.quiet在gmail.com
星期一 七月 9 18:18:01 HKT 2007

On 7/9/07, 赵威 <zhaoweikid在163.com> wrote:
>
> Joe Simer,您好!
>
>   是你啊,哈哈。
> http://www.pythonid.com/bbs/viewthread.php?tid=22&extra;=page%3D1
>
呃....使用  PHP的BBS来汇集Python 知识 --- 好凄凉哪…………
> ======== 2007-07-09 17:53:26 您在来信中写道:  ========
>
>
>
>
> 如题:
> python myprogram.py parameter
>
> 我怎么在程序里面接收 parameter  呢?
>
>
> = = = = = = = = = = = = = = = = = = = = = =
>
>         致
> 礼!
>
>               赵威
>               zhaoweikid在163.com
>                2007-07-09
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
'''Time is unimportant, only life important!
http://zoomquiet.org
blog在http://blog.zoomquiet.org/pyblosxom/
wiki在http://wiki.woodpecker.org.cn/moin/ZoomQuiet
scrap在http://floss.zoomquiet.org
douban在http://www.douban.com/people/zoomq/
____________________________________
Pls. use OpenOffice.org to replace M$ Office.
     http://zh.openoffice.org
Pls. use 7-zip to replace WinRAR/WinZip.
     http://7-zip.org/zh-cn/
You can get the truely Freedom 4 software.
'''

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月09日 星期一 18:25

赵威 zhaoweikid在163.com
星期一 七月 9 18:25:56 HKT 2007

Zoom.Quiet,您好!

	是啊,Python好像自己没有很好的这种实现吧?


======= 2007-07-09 18:18:01 您在来信中写道:=======

>On 7/9/07, 赵威 <zhaoweikid在163.com> wrote:
>>
>> Joe Simer,您好!
>>
>>   是你啊,哈哈。
>> http://www.pythonid.com/bbs/viewthread.php?tid=22&extra;=page%3D1
>>
>呃....使用  PHP的BBS来汇集Python 知识 --- 好凄凉哪…………
>> ======== 2007-07-09 17:53:26 您在来信中写道:  ========
>>
>>
>>
>>
>> 如题:
>> python myprogram.py parameter
>>
>> 我怎么在程序里面接收 parameter  呢?
>>
>>
>> = = = = = = = = = = = = = = = = = = = = = =
>>
>>         致
>> 礼!
>>
>>               赵威
>>               zhaoweikid在163.com
>>                2007-07-09
>>
>> _______________________________________________
>> python-chinese
>> Post: send python-chinese在lists.python.cn
>> Subscribe: send subscribe to python-chinese-request在lists.python.cn
>> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>>
>
>
>
>-- 
>'''Time is unimportant, only life important!
>http://zoomquiet.org
>blog在http://blog.zoomquiet.org/pyblosxom/
>wiki在http://wiki.woodpecker.org.cn/moin/ZoomQuiet
>scrap在http://floss.zoomquiet.org
>douban在http://www.douban.com/people/zoomq/
>____________________________________
>Pls. use OpenOffice.org to replace M$ Office.
>     http://zh.openoffice.org
>Pls. use 7-zip to replace WinRAR/WinZip.
>     http://7-zip.org/zh-cn/
>You can get the truely Freedom 4 software.
>'''
>_______________________________________________
>python-chinese
>Post: send python-chinese在lists.python.cn
>Subscribe: send subscribe to python-chinese-request在lists.python.cn
>Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
>Detail Info: http://python.cn/mailman/listinfo/python-chinese

= = = = = = = = = = = = = = = = = = = =
			

        致
礼!
 
				 
        赵威
        zhaoweikid在163.com
          2007-07-09


[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年07月09日 星期一 18:35

Joe Simer simerjoe在gmail.com
星期一 七月 9 18:35:37 HKT 2007

Õⶼ¿ÉÒÔÅöµ½Å¶,ÇÉ

ÔÚ07-7-9£¬ÕÔÍþ <zhaoweikid在163.com> дµÀ£º
>
> Joe Simer£¬ÄúºÃ£¡
>  ÊÇÄã°¡£¬¹þ¹þ¡£
> http://www.pythonid.com/bbs/viewthread.php?tid=22&extra;=page%3D1
>
> ======== 2007-07-09 17:53:26 ÄúÔÚÀ´ÐÅÖÐдµÀ£º ========
>
>
> ÈçÌâ:
> python myprogram.py parameter
>
> ÎÒÔõôÔÚ³ÌÐòÀïÃæ½ÓÊÕ parameter ÄØ?
>
>  = = = = = = = = = = = = = = = = = = = = = =
>
> ÖÂ
> Àñ£¡
>
>  ÕÔÍþ
>  zhaoweikid在163.com
>  2007-07-09
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20070709/a536c52f/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号