Python中sys模块sys.argv取值并判断
程序员文章站
2024-01-30 17:30:52
#!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("请正确输入")