Requirements
Write a program that will output the following results when you enter Python bigdigists.py 234234.
Source Code
Import Syszero = [" *** ", "* *", "* &NB Sp * ", " * * ", " * * ", &N Bsp "* *", " *** "] #把下面的list竖起来就跟这个zero一个样One = ["*", "* *", "*", "*", " * "," * "," * * * "]two = [" * * * "," * * "," * * "," * "," * "," * "," * * * * " ]three = ["* * *", "* *", " *", " **", " *", "* *", "* * *"]four = ["  ; * "," ** "," * * "," * * "," ****** "," * ", " * "]five = ["* * * * *", "* ", "* ", "* * *", " *", "* *", "* * *" "]six = [" * * * "," * "," * "," * * * "," * * "," * * "," * * * "]seven = [" * * * * * "," * "," * "," * "," * "," * "," * "]eight = [" * * * "," * * "," * "* * "," * * * "," * * "," * * "," * * * "]nine = [" * * * * "," * * "," * * "," * * * "," &N Bsp;* "," * "," * "]digits = [Zero, one, I, three, four, Five, Six, Seven, Eight, Nine]try:&nbs P digits = sys.argv[1] #读取用户输入命令 &NBSP;&N bsp; row = 0 while row < 7: line = "" C Olumn = 0 while column < Len (digits): #len ("Aadfs") function is to determine the word String "Aadfs" length number = Int (Digits[column]) &NBSP ; digit = digits[number] line + Digit[row] + " " #通过使用加好合并字符串 column + = 1 print (line) Row + = 1 Except Indexerror: #如果用户不输入命令, you will be quoted Indexerror error print ("usage:bigdigits.py <numb Er> ") except ValueError as err: print (err," in ", digits)
The problems that arise and the knowledge points to be used1.SYS.ARGV usage
Import Sysprint (sys.argv[0]) print (sys.argv[1]) print (sys.argv[2]) print (sys.argv[3])
Input python test.py arg1 arg2 arg3 output
Test.pyarg1arg2arg3
If you have any questions, welcome to my public question ~
Python practice----Character output