欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

Python中sys模块sys.argv取值并判断

程序员文章站 2022-05-29 12:24:32
#!usr/bin/env python # -*- coding: utf-8 -*- # Author:Sun Xiaolin import sys judgement = sys.argv[1] #[]内写的值表示取第几个 # print(judgement) if judgement == ... ......
#!usr/bin/env python
# -*- coding: utf-8 -*-
# author:sun xiaolin

import sys
judgement = sys.argv[1] #[]内写的值表示取第几个
# print(judgement)
if judgement == "1":
    print("一")
elif judgement == "2":
    print("二")
else:print("请正确输入")