Step by Step Learn Python(1)
print "Hello World!" action = raw_input("please select your action{1, 2, 3, 4, 5, 6, 7, 8, 9, o}: ")
print action if action == str("1"): #print hello name
name = raw_input("what's your name? ")
print "Hello "+name
elif action == str("2"): #print hu and chongshi
hu =["hu", 25]
chongshi=["chongshi", 32]
database = [hu, chongshi]
print database
elif action == "3":
greeting = "chongshi" #print c
print greeting[0]
elif action == "4":
fourth = raw_input("year:")[3] #year:2013 print 3
print fourth
elif action == "5":
tag = '<a href="http://www.python.org">Python web site</a>'
print tag[9:30]
print tag[32:-4]
elif action == "6":
permissions = "rw"
print "w" in permissions users = ["hls", "lisi"]
r = raw_input("enter you user name:") in users #return true or false check input value is not at users
print r
elif action == "7":
numbers = [100, 34, 678]
print "max(numbers) "+ str(max(numbers)) #get max value for numbers print "min(numbers) "+ str(min(numbers)) #get min value for numbers
elif action == "8":
lis = list('chongshi') x = [1,3,4]
x[1] = 2
print x #update item value del x[1] #delete a item
print x x[1:] = list("111v123") #append a list at index 1 of x
print x print 'there have '+str(x.count("1"))+' "1"' #get contains "1" of list x's value y = [4,5,6,7,8]
x.extend(y) #extend y to x
print x print x.index("1") #get index for "1" x.insert(5, "5.5") #insert a value at index 5 later
print x x.pop() #delete a last item
print x x.pop(1) #delete index 1's value
print x x.remove() #delete a first item
print x x.reverse() #reverse items
print x x.sort()
print x
elif action == "9": #tuple
z = 1,2,3
print z z = tuple("12346abc")
print z else:
print '''this is a very long string.
It continues here.
and it's not over yet.'''
Step by Step Learn Python(1)的更多相关文章
- [py]python写一个通讯录step by step V3.0
python写一个通讯录step by step V3.0 参考: http://blog.51cto.com/lovelace/1631831 更新功能: 数据库进行数据存入和读取操作 字典配合函数 ...
- Python 调试:step into/step out/step over 的区别
Python 调试:step into/step out/step over 的区别: 首先在PyCharm 程序中设置 “ 断点 ”,后点击右上角的Debug 按钮进入调试程序状态: step in ...
- [IT学习]Learn Python the Hard Way (Using Python 3)笨办法学Python3版本
黑客余弦先生在知道创宇的知道创宇研发技能表v3.1中提到了入门Python的一本好书<Learn Python the Hard Way(英文版链接)>.其中的代码全部是2.7版本. 如果 ...
- Tomcat Clustering - A Step By Step Guide --转载
Tomcat Clustering - A Step By Step Guide Apache Tomcat is a great performer on its own, but if you'r ...
- Code Understanding Step by Step - We Need a Task
Code understanding is a task we are always doing, though we are not even aware that we're doing it ...
- Step by Step 真正从零开始,TensorFlow详细安装入门图文教程!帮你完成那个最难的从0到1
摘要: Step by Step 真正从零开始,TensorFlow详细安装入门图文教程!帮你完成那个最难的从0到1 安装遇到问题请文末留言. 悦动智能公众号:aibbtcom AI这个概念好像突然就 ...
- Devops step by step
接着上次分享的devops历程[Followme Devops实践之路], 大家希望能够出一个step by step手册, 那今天我就来和手把手来一起搭建这么一套环境, 演示整个过程! 实验环境需要 ...
- 课程五(Sequence Models),第一 周(Recurrent Neural Networks) —— 1.Programming assignments:Building a recurrent neural network - step by step
Building your Recurrent Neural Network - Step by Step Welcome to Course 5's first assignment! In thi ...
- 课程四(Convolutional Neural Networks),第一周(Foundations of Convolutional Neural Networks) —— 2.Programming assignments:Convolutional Model: step by step
Convolutional Neural Networks: Step by Step Welcome to Course 4's first assignment! In this assignme ...
- Neural Networks and Deep Learning(week4)Building your Deep Neural Network: Step by Step
Building your Deep Neural Network: Step by Step 你将使用下面函数来构建一个深层神经网络来实现图像分类. 使用像relu这的非线性单元来改进你的模型 构建 ...
随机推荐
- Eclipse开发Java程序入门,HelloWord
今天看到一个专业的学术程序是Java写的,而我经常用的是Matalb,所以感觉十分不舒服.之前学的Java开发感觉也忘光了,所以感觉,知识必须要总结好,不然容易忘记.这也就是我写这篇文章的原因.希望能 ...
- python使用游标访问数据
游标是一种数据访问对象,可用于在表中迭代一组行或者向表中插入新行.游标有三种形式:搜索.插入或更新.游标通常用于读取现有几何和写入新几何. 每种类型的游标均由对应的 ArcPy 函数(SearchCu ...
- JACOB的语法
转自:http://www.bitscn.com/pdb/java/200904/161117.html 如果你想写一个JAVA代码,其中需要调用JACOB提供的功能,而你还是新手,也许篇文章会大大降 ...
- 高性能WEB开发:深入理解页面呈现、重绘、回流
在讨论页面重绘.回流之前.需要对页面的呈现流程有些了解,页面是怎么把html结合css等显示到浏览器上的,下面的流程图显示了浏览器对页面的呈现的处理流程.可能不同的浏览器略微会有些不同.但基本上都是类 ...
- linux 的命令 -exec 的使用
linux中的 exec命令,-exec 后面跟的是linux的 command 命令,exec命令以分号结束‘:’, 该分号前面要放 反斜杠转义 . find . -name jquery.js - ...
- 当Intellij IDEA 遇到 Mac
当Intellij IDEA 遇到 Mac alt+insert变为control+N
- RS特殊报表样式需求处理
收到一朋友求助:如下图的报表格式 思路如下 第一步:处理出基础数据是每个用户每个月属于每个区间的数据savemoney_bymonthmonth user save_qujian201412 a1 5 ...
- tomcat7的数据库连接池tomcatjdbc的25个优势
tomcat的JDBC连接池org.apache.tomcat.jdbc.pool更换或替代吗Apache Commons DBCP连接池. 为什么我们须要一个新的连接池? 这里有几个原因: 1.DB ...
- 【Python】【Nodejs】下载单张图片到本地,Python和Nodejs的比较
Python版本: # 下载单张图片到本地,看用时多少 import urllib.request import datetime starttime = datetime.datetime.now( ...
- Python-urllib学习记录
urllib是python自带库,不要专门安装,还挺好用的. 脚本语言的好处之一就是随写随用,有些东西用C语言写真的是能把人累死,换成python就是几行代码,so easy,对于喜欢偷懒的同学绝对是 ...