75、python学习第一篇
来源:互联网 发布:微博个性域名是什么 编辑:程序博客网 时间:2024/06/09 18:46
1、sys包下边的argv方法,从控制台获取数据
'''Created on 2017年4月8日@author: weizhen'''import sysOne = [" * ", "**", " * ", " * ", " * ", "***",'*********']Two = ["***", "* *", "* *", " *", " * ", "***",'*********']Three = ["***", "* *", "* *", " *", " * ", "***",'*********']Four = ["***", "* *", "* *", " *", " * ", "***",'*********']Five = ["***", "* *", "* *", " *", " * ", "***",'*********']Six = ["***", "* *", "* *", " *", " * ", "***",'*********']Seven = ["***", "* *", "* *", " *", " * ", "***",'*********']Eight = ["***", "* *", "* *", " *", " * ", "***",'*********']Night = ["***", "* *", "* *", " *", " * ", "***",'*********']Ten = ["***", "* *", "* *", " *", " * ", "***",'*********']Digits = [One, Two, Three, Four, Five, Six, Seven, Eight, Night, Ten]try: digits = sys.argv[1] row = 0 while row < 7: line = "" column = 0 while column < len(digits): number = int(digits[column]) digit = Digits[number] line += digit[row] + " " column += 1 print(line+'in') print(line+'out') row += 1except IndexError: print("usage:bigdigits.py <number>")
就是会判断输入值的大小,并根据控制台输入数组的大小去对字符串进行append
这里要指出,line += digit[row] + " "这一行只是对字符串进行append,所有会用+=并不是对字符串进行连加
阅读全文
0 0
- 75、python学习第一篇
- Python基础学习--第一篇
- Python第一篇面向对象学习
- Python学习第一篇之python 连接字符串和数字
- Python学习第一篇:python的简单使用
- python学习随笔——第一篇:Python简介
- 【python】入门第一篇
- 第一篇:开始Python
- 第一篇python
- Python初学第一篇
- python第一篇
- python第一篇
- 第一篇:初识Python
- 第一篇python爬虫
- python 学习笔记 第一篇:开发环境搭建
- Python的matplotlib库学习笔记第一篇
- servlet学习(第一篇)
- 多线程学习第一篇
- [LeetCode]根据树的遍历还原树(1)
- 72、salesforce call RESTful 的方式
- 73、salesforce通过JAVA来Call在salesforce中已经写好的Restful处理接口
- 《Spring 5 官方文档》14.DAO support
- 74、Salesforce的String的format方法
- 75、python学习第一篇
- 抽奖
- 76、python学习第二篇
- 关于JMeter的CSV Data Set Config的源码改写(包括了部分界面等代码的分析)
- 77、tensorflow手写识别基础版本
- 78、tensorflow滑动平均模型,用来更新迭代的衰减系数
- 79、tensorflow计算一个五层神经网络的正则化损失系数、防止网络过拟合、正则化的思想就是在损失函数中加入刻画模型复杂程度的指标
- Stanford-CS231n深度视觉识别作业笔记
- Educational Codeforces Round 30 A. Chore