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这的非线性单元来改进你的模型 构建 ...
随机推荐
- Visual Studio 2012连接TFS2010登录不了
一直用VS2012+TFS2010开发项目, 最近几天忽然很不正常, 在VS中会频繁要求输入TFS的账号密码, 经常要输入很多遍才可以正常连接签入签出. 这几天更甚, 基本上直接连接不了了. 网上找到 ...
- iOS开源项目:UIDevice-with-UniqueIdentifier-for-iOS-5
用于替代系统UDID的方法. https://github.com/gekitz/UIDevice-with-UniqueIdentifier-for-iOS-5 1.使用方法: UILabel *l ...
- Informatica 常用组件Source Qualifier之三 联接查询
联接源数据 可以使用一个源限定符转换来联接来自多个关系表的数据.这些表必须能从相同的实例或数据库服务器访问.当映射使用相关的关系源时,您可以在一个源限定符转换中同时联接两个源.在会话期间,源数据库在传 ...
- python2 python3编码问题记录
最近在服务器上跑脚本,linux自带的是python 2.x,中文显示经常有问题,通过下面两篇终于弄懂了. https://www.cnblogs.com/575dsj/p/7112767.html ...
- 【Scroller】scrollTo scrollBy startScroll computeScroll 自定义ViewPage 简介 示例
简介 android.widget.Scroller是用于模拟scrolling行为,它是scrolling行为的一个帮助类.我们通常通过它的 startScroll 函数来设置一个 scrollin ...
- tcp/ip协议中的SYN, ACK的数值变化
还需要论述一下seq.ack表示什么意思,应该以什么样的角度去理解这两个序列号. sequence number:表示的是我方(发送方)这边,这个packet的数据部分的第一位应该在整个data st ...
- installshield12如何改变默认安装目录
installshield12如何改变默认安装目录 androidstudio添加其他项目中的module androidrecyclerviewonBindViewHolder [RealSense ...
- tomcat服务器开启gzip功能的方法
http://blog.csdn.net/wang_159369/article/details/8107163 tomcat5.0以后的版本是支持对输出内容进行gzip格式的压缩的.该功能默认是关闭 ...
- Android与WebView的同步和异步訪问机制
大家都知道.通过WebView,我们能够在Androidclient.用Web开发的方式来开发我们的应用. 假设一个应用就是单纯一个WebView.全部的逻辑都仅仅须要在网页上交互的话,那我们事实上就 ...
- 算法笔记_024:字符串的包含(Java)
目录 1 问题描述 2 解决方案 2.1 蛮力轮询法 2.2 素数相乘法 2.3 位运算法 1 问题描述 给定一长字符串A和一短字符串B.请问,如何最快地判断出短字符串B中的所有字符是否都在长字符串A ...