新聞中心
這篇文章將為大家詳細(xì)講解有關(guān)python選項參數(shù)的示例分析,小編覺得挺實用的,因此分享給大家做個參考,希望大家閱讀完這篇文章后可以有所收獲。
網(wǎng)站設(shè)計制作過程拒絕使用模板建站;使用PHP+MYSQL原生開發(fā)可交付網(wǎng)站源代碼;符合網(wǎng)站優(yōu)化排名的后臺管理系統(tǒng);網(wǎng)站建設(shè)、網(wǎng)站制作收費合理;免費進行網(wǎng)站備案等企業(yè)網(wǎng)站建設(shè)一條龍服務(wù).我們是一家持續(xù)穩(wěn)定運營了十年的創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司。
#!c:python26python.exe
import optparse
def main():
MSG_USAGE = "opt.py [-s
p = optparse.OptionParser(MSG_USAGE)
p.add_option('-s','--server',default="127.0.0.1",help="Server ip your self with this option.")
p.add_option('-p','--port',default="6666",type="int",help="Server port your self with this option.")
p.add_option('-c','--client',default="localhost",help="Client ip your self with this option.")
options, arguments = p.parse_args()
print 'Server: %snPort: %snClient: %s' % (options.server,options.port,options.client)
if __name__ == '__main__':
main()
[@more@]
關(guān)于“python選項參數(shù)的示例分析”這篇文章就分享到這里了,希望以上內(nèi)容可以對大家有一定的幫助,使各位可以學(xué)到更多知識,如果覺得文章不錯,請把它分享出去讓更多的人看到。
新聞名稱:python選項參數(shù)的示例分析
分享URL:http://www.ef60e0e.cn/article/psheee.html