SlideShare ist ein Scribd-Unternehmen logo
1 von 51
Downloaden Sie, um offline zu lesen
Python Intro
                    @fantasy614
           fantasy614@gmail.com
                     研究院北415
      哈工大(威海)开源技术沙龙第一期
免责声明


  一切资料来自网络互动挖掘
  一切想法来自日常学习工作
  一切体悟种沟通交流
  一切知识来自社区分享印证
  一切经验来自个人失败体验
  ......




                 非原创,山寨Zoom.Quiet
开源沙龙第一期 Python intro
从大牛说起
Bruce Eckel
Bruce Eckel




              Page
Why I Love Python
© 2001 Bruce Eckel
MindView, Inc.
Training & Consulting
5343 Valle Vista
La Mesa, CA 91941
Bruce@EckelObjects.com
www.MindView.net
ftp://www.mindview.net/pub/eckel/LovePython.zip
另外一个例子
请在20秒钟内用你最熟悉的语言在心中构
建出下题的所有源代码(非思路)

 从一个文本文件中读取所有字
 符串,然后将“windows”替
 换成“linux”,保存在另外
 一个文件中
如此冗长,你的青春浪费在查找各种
     API手册上面了
Python的一个实现版本。。。


infile = file("infile","r")
outfile = file("outfile", "w")
for line in infile.readlines():
       newline=line.replace("windows","linux")
       outfile.write(newline)
Or,Even...


infile = file("infile.txt","r")
outfile = file("outfile.txt", "w")
outfile.write(infile.read().replace("windows","linux"))
So, what is pyton?
what is python
And,why python?
Why Python?
   简单易学
    Hello World: 1分钟
    小工具脚本: 1下午
    实用程序: 1周 做个豆瓣: 3个月(@hongqn,
    豆瓣首席架构师)
Why Python?
 资源丰富
   Battery Included: 标准库内置200+模块
   PyPI: 9613 packages currently
   网络/数据库/桌面/游戏/科学计算/安全/文本处
   理/...
   easily extensible
Why Python?
   内置高级数据类型和操作,list,dict,tuple,etc
   跨平台,Linux/Unix,Win,Mac
   支持广泛,特别是google的服务
   胶水,可以和C,C++,java,c#等混合编程
   Open Source,没有铜臭味
   内置GC,无需程序员做内存管理
Who use python?
Who use python
  Google
  Youtube
  Douban
  Dropbox
  金山, 网易,新浪
  BitTorrent
  NASA
  Plurk
What python can't do?
Sorry。。。
   我只能告诉你python不适合于做什么
驱动程序以及对效率要求极高的程序(如科学运算)
Python 应用
    Web and Internet Development (django,web.py,zope,etc)
    Database Access (odbc,st)
    Desktop GUIs (QT,gtk,wx,MFC)
    Scientific and Numeric
    Education
    Network Programming (Socket,Twisted)
    Software Development
    Game and 3D Graphics (pygame)

http://www.python.org/about/apps/
Python compared to
   other languages
一般的说法是这样
一般说法
 Perl 擅长做服务器的管理,因为它的字串处理功能
 特别强大,同时有全面的编程接口和操作系统相
 连。自己用没问题,就是不懂人家在写什么。
 PHP 擅长于网页,因为它可以嵌入在 HTML 文件中
 并支援各类资料库。但一离开网页就左支右绌。
 Tcl/Tk 基本变数形态只有文字串,每次算术都是从
 文字变数字再变文字,鸣,没什么好提的了吧。
 Java 太伟大了,我可不想每次开始写程式时都幻想
 要完成一个跨企业的解决方案,引入几十个标头
 档,写完了才明白原来我只需它读一个用户指定的
 文件,画两条直线就行了。唉,落差太大。
 Ruby 太新了,要正式应用是将来的事。
但是还是得看牛人咋说的
Interview with Bruce Eckel by Clay Shannon

 Compare and contrast Java, C++, Delphi, Python, and
 C#--what are the advantages/disadvantages of each?

 Saving the best for last, I've said in numerous places that Python is my favorite
 language, and this is because I'm most productive in that language. I can get so
 much more done in Python than in any other language I've encountered that
 it's very hard for me to use those other languages, because to do so means
 throwing away time. Also, I've found the Python community to be my favorite
 group of language people; I can't figure out how or why this is the case, but it
 retains the gentleness and enthusiasm that I most value in my interactions
 with a language community. I look forward to when I finally get my plate
 cleared enough that I can continue working on "Thinking in Python."

 http://edn.embarcadero.com/article/30139
python 之道
The zen of python

  There is only one way to do it. 要做好一件事,一种方法就够
  Everything is object.             万物皆对象
  Readability counts.               可读性优先
  Explicit is better than implicit. 明显胜于隐晦
  Simple is better than complex. 简单胜于复杂
闲扯关于python 其它实现
Python的其它实现
  CPython(Classic Python,也就是原始的经典Python
  实现,需要区别于其他实现的时候才以CPython称
  呼;或解作C语言实现的Python)
  Jython(原名JPython;Java语言实现的Python,现已正
  式发布)
  PyPy(使用Python语言写的Python)
  IronPython(面向.NET和ECMA CLI的Python实现)
  周蟒(支持繁简中文的Python语言)
Django框架介绍
Stackoverflow 上的红人Django
Django的优点

   URL映射
   MVC
   Admin界面
   方便的ORM
   功能强大的模板
   统一的管理中心
   Pythonic,学习成本低
Xmlrpc介绍
Server:
 from SimpleXMLRPCServer import SimpleXMLRPCServer
 def foo():
   return "Hello world!"
 server = SimpleXMLRPCServer( ("localhost", 8000) )
 server.register_function(foo)
 server.serve_forever()


Client:
from xmlrpclib import ServerProxy
 server = ServerProxy("http://localhost:8000")
 print server.foo()
Web Server
• python -m SimpleHTTPServer
  内部网络文件共享,just so simple
Python的IDE
Python的IDE
  IDLE:Python“标准”IDE
  Komodo和Komodo Edit:后者是前者的免费精简版
  PythonWin:ActivePython软件包的IDE,仅适用于
  Windows
  SPE(Stani's Python Editor):功能较多的自由软件,
  依赖wxPython
  Ulipad:功能较全的自由软件,依赖wxPython;作者是
  中国Python高手limodou
  WingIDE:可能是功能最全的IDE,但不是自由软件
  Eric:基于PyQt的自由软件,功能强大
Python的IDE
有相应插件的通用IDE软件(使用难度往往较大):
 eclipse + pydev插件:稳定性欠佳
 emacs + 插件
 Vim + 插件
 Visual Studio .NET 2003 + VisualPython:仅适用Windows,
 已停止维护,功能较差
 SlickEdit
 TextMate
Python社区
啄木鸟社区 http://wiki.woodpecker.org.cn/moin/首页
Google Groups http://groups.google.com/
书目
开源沙龙第一期 Python intro
开源沙龙第一期 Python intro
开源沙龙第一期 Python intro
开源沙龙第一期 Python intro
开源沙龙第一期 Python intro
一些URL

  http://www.python.org
  http://wiki.woodpecker.org.cn/moin/首页
  http://stackoverflow.com/
  http://www.djangoproject.com/
  http://www.mindview.net/
  http://groups.google.com/
  http://www.slideshare.net/
  http://edn.embarcadero.com/article/30139
  http://www.wikipedia.org/
  http://www.google.com/
Thanks !
     Life is short,you need python

Weitere ähnliche Inhalte

Was ist angesagt?

python for linguists
python for linguistspython for linguists
python for linguistsshukaihsieh
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Younggun Kim
 
Python 101 for the .NET Developer
Python 101 for the .NET DeveloperPython 101 for the .NET Developer
Python 101 for the .NET DeveloperSarah Dutkiewicz
 
What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)wesley chun
 
Python, the Language of Science and Engineering for Engineers
Python, the Language of Science and Engineering for EngineersPython, the Language of Science and Engineering for Engineers
Python, the Language of Science and Engineering for EngineersBoey Pak Cheong
 
A commercial open source project in Python
A commercial open source project in PythonA commercial open source project in Python
A commercial open source project in Pythonjbrendel
 
Scientific Programming in Python
Scientific Programming in PythonScientific Programming in Python
Scientific Programming in Pythonzukun
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming KrishnaMildain
 
Python簡介和多版本虛擬環境架設
Python簡介和多版本虛擬環境架設Python簡介和多版本虛擬環境架設
Python簡介和多版本虛擬環境架設Tien-Yang (Aiden) Wu
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with pythonPraveen M Jigajinni
 
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...pythoncharmers
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to pythonAgung Wahyudi
 
Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Bruno R. Zanuzzo
 
Chat bot making process using Python 3 & TensorFlow
Chat bot making process using Python 3 & TensorFlowChat bot making process using Python 3 & TensorFlow
Chat bot making process using Python 3 & TensorFlowJeongkyu Shin
 
Python: the Project, the Language and the Style
Python: the Project, the Language and the StylePython: the Project, the Language and the Style
Python: the Project, the Language and the StyleJuan-Manuel Gimeno
 

Was ist angesagt? (18)

python for linguists
python for linguistspython for linguists
python for linguists
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015
 
Python 101 for the .NET Developer
Python 101 for the .NET DeveloperPython 101 for the .NET Developer
Python 101 for the .NET Developer
 
What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)What is Python? (Silicon Valley CodeCamp 2015)
What is Python? (Silicon Valley CodeCamp 2015)
 
Python intro for Plone users
Python intro for Plone usersPython intro for Plone users
Python intro for Plone users
 
Python, the Language of Science and Engineering for Engineers
Python, the Language of Science and Engineering for EngineersPython, the Language of Science and Engineering for Engineers
Python, the Language of Science and Engineering for Engineers
 
A commercial open source project in Python
A commercial open source project in PythonA commercial open source project in Python
A commercial open source project in Python
 
Scientific Programming in Python
Scientific Programming in PythonScientific Programming in Python
Scientific Programming in Python
 
Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming Python programming | Fundamentals of Python programming
Python programming | Fundamentals of Python programming
 
Python簡介和多版本虛擬環境架設
Python簡介和多版本虛擬環境架設Python簡介和多版本虛擬環境架設
Python簡介和多版本虛擬環境架設
 
Chapter 8 getting started with python
Chapter 8 getting started with pythonChapter 8 getting started with python
Chapter 8 getting started with python
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...Python for Science and Engineering: a presentation to A*STAR and the Singapor...
Python for Science and Engineering: a presentation to A*STAR and the Singapor...
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015
 
Python - Lesson 1
Python - Lesson 1Python - Lesson 1
Python - Lesson 1
 
Chat bot making process using Python 3 & TensorFlow
Chat bot making process using Python 3 & TensorFlowChat bot making process using Python 3 & TensorFlow
Chat bot making process using Python 3 & TensorFlow
 
Python: the Project, the Language and the Style
Python: the Project, the Language and the StylePython: the Project, the Language and the Style
Python: the Project, the Language and the Style
 

Ähnlich wie 开源沙龙第一期 Python intro

Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009tudorprodan
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its ApplicationsAbhijeet Singh
 
Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425Sapna Tyagi
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyTIB Academy
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech PunePython Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech PuneEthan's Tech
 
Python 101 For The Net Developer
Python 101 For The Net DeveloperPython 101 For The Net Developer
Python 101 For The Net DeveloperSarah Dutkiewicz
 
Behold the Power of Python
Behold the Power of PythonBehold the Power of Python
Behold the Power of PythonSarah Dutkiewicz
 
Py Con 2009 Pumping Iron Into Python
Py Con 2009   Pumping Iron Into PythonPy Con 2009   Pumping Iron Into Python
Py Con 2009 Pumping Iron Into PythonSarah Dutkiewicz
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data sciencebhavesh lande
 
A Whirlwind Tour Of Python
A Whirlwind Tour Of PythonA Whirlwind Tour Of Python
A Whirlwind Tour Of PythonAsia Smith
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming LanguageR.h. Himel
 

Ähnlich wie 开源沙龙第一期 Python intro (20)

what is python ?
what is python ? what is python ?
what is python ?
 
Python @ PiTech - March 2009
Python @ PiTech - March 2009Python @ PiTech - March 2009
Python @ PiTech - March 2009
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
 
Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech PunePython Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech Pune
 
Doing the Impossible
Doing the ImpossibleDoing the Impossible
Doing the Impossible
 
Python 101 For The Net Developer
Python 101 For The Net DeveloperPython 101 For The Net Developer
Python 101 For The Net Developer
 
Behold the Power of Python
Behold the Power of PythonBehold the Power of Python
Behold the Power of Python
 
Python in 15 minutes
Python in 15 minutesPython in 15 minutes
Python in 15 minutes
 
Py Con 2009 Pumping Iron Into Python
Py Con 2009   Pumping Iron Into PythonPy Con 2009   Pumping Iron Into Python
Py Con 2009 Pumping Iron Into Python
 
introduction of python in data science
introduction of python in data scienceintroduction of python in data science
introduction of python in data science
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Violent python
Violent pythonViolent python
Violent python
 
Learn python
Learn pythonLearn python
Learn python
 
A Whirlwind Tour Of Python
A Whirlwind Tour Of PythonA Whirlwind Tour Of Python
A Whirlwind Tour Of Python
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
 
_python Raunak.pptx
_python Raunak.pptx_python Raunak.pptx
_python Raunak.pptx
 
Introduction python
Introduction pythonIntroduction python
Introduction python
 

Mehr von fantasy zheng

Vpn intro by dongshuzhao
Vpn intro by dongshuzhaoVpn intro by dongshuzhao
Vpn intro by dongshuzhaofantasy zheng
 
The true story_of_hello_world
The true story_of_hello_worldThe true story_of_hello_world
The true story_of_hello_worldfantasy zheng
 
开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2fantasy zheng
 
开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2fantasy zheng
 
开源沙龙第一期个人知识管理
开源沙龙第一期个人知识管理开源沙龙第一期个人知识管理
开源沙龙第一期个人知识管理fantasy zheng
 

Mehr von fantasy zheng (9)

Android dev o_auth
Android dev o_authAndroid dev o_auth
Android dev o_auth
 
Phpsecurity.ppt
Phpsecurity.pptPhpsecurity.ppt
Phpsecurity.ppt
 
Vpn intro by dongshuzhao
Vpn intro by dongshuzhaoVpn intro by dongshuzhao
Vpn intro by dongshuzhao
 
F**k Gfw
F**k  GfwF**k  Gfw
F**k Gfw
 
The true story_of_hello_world
The true story_of_hello_worldThe true story_of_hello_world
The true story_of_hello_world
 
开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2
 
开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2开源沙龙第一期 个人知识管理2
开源沙龙第一期 个人知识管理2
 
开源沙龙第一期个人知识管理
开源沙龙第一期个人知识管理开源沙龙第一期个人知识管理
开源沙龙第一期个人知识管理
 
软件工程2010
软件工程2010软件工程2010
软件工程2010
 

开源沙龙第一期 Python intro