zoukankan      html  css  js  c++  java
  • 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.'''
    
  • 相关阅读:
    jquery ajax loading效果
    php中count 多维数组长度统计实现方法
    jquery 中Map、each的应用
    转:php获取网页内容方法总结
    经典JavaScript正则表达式实战
    JQuery this 和 $(this) 的区别
    Windows Server 2003 的 Boot.ini 文件的/3GB开关选项
    用ghost装双系统(装03,xp系统)
    Possible memory leak with ReportViewer.RefreshReport() ReportViewer内存回收缺陷
    添加IIS出错,提示缺少CONVLOG.exe文件
  • 原文地址:https://www.cnblogs.com/haoliansheng/p/4965948.html
Copyright © 2011-2022 走看看