python web开发介绍_图文

上传人:迪迦****号 文档编号:26455092 上传时间:2017-12-27 格式:PPT 页数:32 大小:1.52MB
返回 下载 相关 举报
python web开发介绍_图文_第1页
第1页 / 共32页
python web开发介绍_图文_第2页
第2页 / 共32页
python web开发介绍_图文_第3页
第3页 / 共32页
python web开发介绍_图文_第4页
第4页 / 共32页
python web开发介绍_图文_第5页
第5页 / 共32页
点击查看更多>>
资源描述

《python web开发介绍_图文》由会员分享,可在线阅读,更多相关《python web开发介绍_图文(32页珍藏版)》请在金锄头文库上搜索。

1、Python web 开发介绍,2014.12.22DBA 王洪权,内容概要,一 python简介二 python常用的数据结构(字符串,元组,字典,列表,函数,类,继承,模块引用,文件操作)三 Django web框架介绍四 Django 实例五 DevOps 文化,Python(英语发音:/pan/), 是一种面向对象、解释型计算机程序设计语言,由Guido van Rossum于1989年底发明,第一个公开发行版发行于1991年,Perl Java Python Ruby PHP1987 19901994 1991 1993 1995,python简介,Python现在成为美国名校中最流

2、行的编程入门语言,Python是美国大学计算机科学系入门课程最受欢迎的编程语言。计算机科学系Top10中有8家Top39中24家,在入门课程中教授Python (2014年7月调查统计)。,python简介,过程概述Python先把代码(.py文件)编译成字节码,交给字节码虚拟机,然后虚拟机一条一条执行字节码指令,从而完成程序的执行。,python简介,Python程序的执行原理,Life is short, you need Python -Bruce Eckel,python简介,无需声明变量value = 20print value20value = 100.23print value1

3、00.23value = Hello world“print value * 3Hello worldHello worldHello world,Python语法,pythonprint Hello WorldHello World,Javavi HelloWorld.java public class HelloWorld public static void main(String args) System.out.println(Hello World!); javac HelloWorld.java java HelloWorldHello World!,name = raw_inp

4、ut(what is you name?),print hello,name,welcom to you,hello jack welcom to you,Python-输入,Python数据结构-字符串,name = Arul,name0Amyname = Arul + alan Arulalan,name = This is python stringname.split( ) This, is, python, stringcomma = Shrini,Arul,Sureshcomma.split(,) Shrini, Arul, Suresh,li = a,b,c,dnew = -.j

5、oin(li) a-b-c-dnew.split(-) a, b, c, d,small.upper()SMALLBIG.lower() bigmIxEd.swapcase()MiXwD,Python数据结构-列表,numbers = one, two, three, four,five ,print numbers0oneprint numbers4fiveprint numbers2threeprint len(numbers) 5,primes = 11, 5, 7, 2, 13, 3 primes.sort() 2, 3, 5, 7, 11, 13primes.append(14)pr

6、int primes2, 3, 5, 7, 11, 13, 14,primes.reverse()print primes14, 13, 11, 7, 5, 3, 2,price = apple,10,banana,30 price1+2030 price2.upper()BANANA,item = iphone : 5999,huaiwei : 3000,xiaomi : 2999,meizu : 1999 itemiphone5999 itemmeizu1999 item.get(lenove,None)None, item.keys()meizu, huaiwei, iphone, xi

7、aomi item.values()1999, 3000, 5999, 2999 for key,value in item.iteritems():. print key,= ,value. meizu = 1999huaiwei = 3000iphone = 5999xiaomi = 2999,Python数据结构-数据字典,Python数据结构-元组,names=(hello,world,hey)names.append(222)AttributeError: tuple object has no attribute append,Python数据结构-函数,def printMax(

8、a, b): if a b: print a, is maximum else: print b, is maximum printMax(3, 4)4 is maximum,def sayHello(): print Hello World!, sayHello()Hello World!,Python数据结构-类,class Person: pass p = Person()print p= 5000 : print “You win!”elif score = 0 : print “You lose!” print “Game over.”else: print “Current sco

9、re:”,score print “Donen”,Python-条件判断,Python-循环,for i in range(1, 5): print i1234,number = 23running = Truewhile running : guess = int(raw_input(Enter an integer : ) if guess = number : print Congratulations, you guessed it. running = False elif guess import time time.sleep(10) print the time is star

10、tthe time is start time.sleep(10) print the time is endthe time is end, import os os.listdir(/home/) otp_src_R16B02.tar.gz, mysql_percona, mysql,rabbitmq os.mkdir(/home/helloworld) os.listdir(/home/)otp_src_R16B02.tar.gz, mysql_percona, mysql, helloworld, rabbitmq,Python-引用模块,vi demo.py#!/usr/local/

11、bin/pythondef hi(): print hello,welcome!version = 0.11,vi demo1.py #!/usr/local/bin/pythonimport demodemo.hi()print version,demo.version,python demo1.py hello,welcome!version 0.11,vi demo1.py #!/usr/local/bin/pythonfrom demo import hi,versionhi()print version,version,python demo1.py hello,welcome!version 0.11,cat test.txt 12345cat file.py f = file(test.txt,r)for line in f.readlines(): print line.strip(n)f.close()python file.py12345,Python-文件操作,cat filewrite.pyf=file(test1.txt,w)for i in range(11): f.write(str(i)+n)f.close()python filewrite.py012345678910,

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 总结/报告

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号