Your SlideShare is downloading. ×

Python @NCKU CSIE

1,147

Published on

National Cheng Kung University …

National Cheng Kung University
2013 Programming Language
Talk About Python

Published in: Education, Technology
0 Comments
10 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,147
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
57
Comments
0
Likes
10
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Python 郭⾄至軒(KuoE0) KuoE0.tw@gmail.com KuoE0.ch @ Programming Language 2013
  • 2. Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) http://creativecommons.org/licenses/by-sa/3.0/ Latest update: Jan 10, 2014,
  • 3. What is Python?
  • 4. What is Python? a programming language
  • 5. What is Python? easy to Read easy to Write easy to Learn a programming language
  • 6. Top Language in TIOBE Position May 2013 Position May 2012 Delta in Position Programming Language 1 2 3 4 5 6 7 8 9 10 1 2 4 3 5 6 7 8 9 11 = = ↑ ↓ = = = = = ↑ C Java Objective-C C++ C# PHP Visual Basic Python Perl Ruby http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
  • 7. Top Languages in Github Javascript 21% Ruby 12% Java 8% Python 8% Shell 8% PHP 7% C 6% C++ 5% Perl 4% Objective-C 3% 0% 5% 10% 15% 20% 25% https://github.com/languages
  • 8. Top Languages in Github Javascript 21% Ruby 12% Java 8% Python 8% Shell 8% PHP 7% C 6% C++ 5% Perl 4% Objective-C 3% 0% 5% 10% 15% 20% 25% https://github.com/languages
  • 9. What does the logo mean?
  • 10. 界 Kingdom 動物界 Animalia ⾨門 Phylum 脊索動物⾨門 Chordata 綱 Class 爬蟲科 Reptilia ⺫⽬目 Order 有鱗⺫⽬目 Squamata 科 Family 蟒科 Pythonidae 屬 Genus 蟒屬 Python
  • 11. http://wallpapers.free-review.net/15__Tree_python.htm
  • 12. http://wallpapers.free-review.net/15__Tree_python.htm
  • 13. More About Python...
  • 14. More About Python... Interpreted Language Do not need to compile!
  • 15. Compiled Language compiler execute
  • 16. Interpreted Language But, interpret in execution time. execute And, it would be slow...
  • 17. More About Python... Object-Oriented Language Everything in Python is object!
  • 18. number string list function Object
  • 19. number string list function Object
  • 20. overloading inheritance multiple inheritance polymorphism
  • 21. More About Python... Imperative Programming Generic Programming Functional Programming
  • 22. Philosophy
  • 23. Philosophy There should be one— and preferably only one —obvious way to do it.
  • 24. Philosophy There should be one— and preferably only one —obvious way to do it.
  • 25. Zen of Python $
  • 26. Zen of Python $ python -ic “”
  • 27. Zen of Python $ python -ic “” >>>
  • 28. Zen of Python $ python -ic “” >>> import this
  • 29. Zen of Python one There temptation to guess. and refuse In --obviousbe Unless Errors Althoughcasesbetter breakis betternever pass Peters Specialfacebetter may beats ReadabilityPython,tonested. Sparse explicitly silenced. FlatZenshould“”ambiguity,silently. Complexispracticality dense. obvious Simpleshouldofaren'tthanit. enough Explicitisrules. than complex. Beautifulisthisthanthan implicit.the at The importbetterone--docomplicated. only >>>thethe-iccounts.byspecialpurity. to $ pythonofisbetterthanTimugly. that way not preferably be first one There temptation to way In --obvious guess. and preferably Unless casesyou're Errors betternever Dutch.refuse Althoughisrules. may beats breakisfacebetter topass Peters Specialexplicitlythan dense. ReadabilityPython,silenced. Sparseunlessofaren'tnested. obvious FlatZenshouldbeambiguity,silently. Complexisthatbetter thanit. enough Simpleshouldcounts.than implicit.the at Explicitofbetterone-- complex. Beautifulpracticalitydocomplicated. only The importisbetterthanTimugly. >>>thetheisthisthanbyspecialpurity. to not be Now first one is cases than There temptationrules. In --obvious way may and preferably Unless betterguess. beats Errors better never Dutch.refuse Althoughisbetterone-- dense. breakisfacetoyou're pass Peters Specialexplicitly tonested. Readabilitybetterthan complex. Sparseunlessofaren'tthanit. obvious FlatZenshouldbethannever.silently. Complexisthatbetterthan implicit.the Simpleshouldcounts.bydocomplicated. at Explicitofisbettersilenced. enough only Beautifulpracticalityspecialpurity. to ThethetheisPython,thanTimugly. ambiguity, be not Now first one is cases thanmay not preferably There temptationbetterone-- andsilently. In the better way to beats Unless face Errorsunlessofguess. dense. Althoughbetternever Dutch.refuse breakisexplicitly silenced. Specialshould aren'tpassbetter Readabilitytoyou're nested. obvious Sparseshouldcounts. thanit. enough Flat--obviousbethannever.ugly. Complexisthatbetterthan implicit.the at Simplethepracticalitydocomplicated. only Explicitisisbetterthancomplex. than *right* Beautifulisbetterthanspecialpurity. to never ambiguity, be rules. often is now. Now first one is cases thanmay not preferably There temptationbetterone-- andsilently. In the better way to beats Unless face Errorsunlessofguess. dense. Althoughbetternever Dutch.refuse breakisexplicitly silenced. Specialshould aren'tpassbetter Readabilitytoyou're nested. obvious Sparseshouldcounts. thanit. enough Flat--obviousbethannever.ugly. Complexisthatbetterthan implicit.the at Simplethepracticalitydocomplicated. only Explicitisisbetterthancomplex. than *right* Beautifulisbetterthanspecialpurity. to never ambiguity, be rules. often is If now. Now first one is cases thanoften There implementation isbetter temptationrules. may not preferably In the better way to andhard than Unless face ofguess. beats Errorsunlesscounts. Dutch.refuse Althoughbetternever passit. breakisexplicitly silenced. Specialshould aren'tnested. obvious Readabilitytoyou'renever.silently. Sparseshouldbetterthandense. enough at Flat--obviousbethanthan implicit.explain, Complexispracticality complex.to the only Simpletheisbetterthandocomplicated. *right* Explicitisbetterone--specialpurity. to never is that ambiguity, be it's If now. Now first one is bad idea. may isbetter Therea implementation not preferably temptationrules. to andhard than In the better way silenced. Unless faceto guess. beats Errorsunlessofnever Althoughisbetterone-- dense. breakisexplicitly thancomplex.to explain, Specialshould aren'tDutch.refuse the Readabilitybetterthandocomplicated. Sparseshouldcounts. passit. obvious at Flat--obviousyou're nested. enough only Complexisthatbethannever.silently. *right* Simplethepracticalityspecialpurity. to cases ambiguity, be betterthanoften never is it's If now. Now first bad idea. may one is implementation isbetter Therea better way to noteasy temptationrules. silenced. In the faceto guess. andhard than Unlessunlessofnever Errorsshouldcounts. Dutch.refuse explain, Althoughisbetterone-- beats breakisexplicitly thandense. to the Specialshould aren'tpassit. obvious Readabilitybetterthandocomplicated. at Sparsethethatyou're nested. enough only Flat--obviousbethannever.silently. *right* Complexispracticalityspecialpurity. to cases ambiguity, preferably betterthanoften never is be it it's If now. Now is badrules. may first implementation is preferably onemay better thanto noteasy Therea faceidea. silenced. temptationbetterone-- andhard than In the explicitlyidea.beats Unlessunlessofwaythan dense. Errorsshouldcounts. Althoughbetterguess. do betterto explain, breakisshould never Dutch.refuse the Specialisthat aren'tpassit. obvious at Readabilitytoyou're nested. enough only Sparsethepracticalityspecialpurity. *right* Flat--obviousbethannever.silently. to benever ambiguity, be cases is often a good Namespacesaare is often it it's If now.is badrules. may Now --obvious thanto is first implementation not be onemay better way silenced. There faceidea. idea.andeasy than temptationbetterone-- beats In the explicitlythan dense. obvious Unless should guess. do betterto idea Errorsunlessofnever Dutch.preferably Althoughcases aren'tpassit.great explain, breakashouldcounts.honkingrefuse the at Specialisthatyou'renever.hardenough only Readabilitytobeambiguity,silently. *right* Sparsethepracticalityspecialpurity. to-benever one good let's bad good often Namespacesaareof may it it's If now.is implementation is Now --obvious thanto not be first better way silenced. onemay faceidea. those! There explicitlyidea.andeasy than temptationrules.one-- beats obvious In thedo that guess. do betterto idea Unlessunlessofnever Dutch.preferably Errorsshouldcounts.honkingrefuse explain, Althoughcases aren'tpassit.great the at breakathepracticalityspecialpurity. only Specialshouldyou'renever.hardenough *right* Readabilitytobeambiguity,silently. to-benever is more one >>> let's bad areof often Namespacesaidea. may is it it's If now.is implementation not Now --obvious thanto and be first better way silenced. onemay faceto guess.Dutch.preferably There explicitlythose! easy than temptationrules. idea.beats obvious In thedo that neverhonkingrefuse idea Unlessunlessgoodone--do betterto explain, Errorsshouldofaren'tpassit.great the at Althoughcasesyou'renever.hardenough only breakathepracticalityspecialpurity. *right* Specialshouldbeambiguity,silently. to-benever is more one
  • 30. Current Situation
  • 31. Current Situation Python 2.x Python 3.x
  • 32. Current Situation Python 2.x Python 3.x Coexist!
  • 33. Current Situation Python 2.x Python 3.x Coexist!
  • 34. Current Situation backwards-incompatible Python 2.x Python 3.x Coexist!
  • 35. Python 2.x Python 3.x 2.7.x is the latest version under development more 3-party library 2to3.py built-in on many OS more supported unicode the past in someday the future in someday
  • 36. Python 3 的新特性 http://www.ibm.com/developerworks/cn/linux/l-python3-1/
  • 37. Python 2.x
  • 38. Today, Let’s Talk About Python 2.x
  • 39. Environment
  • 40. Environment For Unix-like OS User, Python 2.x is Built-in!
  • 41. Environment For Windows User, Download From http://www.python.org/download/ if you want to launch Python in command line, add the path of Python binary file into PATH variable.
  • 42. Check Version of Python $
  • 43. Check Version of Python $ python --version
  • 44. Check Version of Python $ python --version Python 2.7.5
  • 45. Check Version of Python $ python --version Python 2.7.5 2.7.5 is released on May 15, 2013
  • 46. Check Version of Python $
  • 47. Check Version of Python $ python
  • 48. Check Version of Python $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
  • 49. Check Version of Python $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
  • 50. Interactive Shell $
  • 51. Interactive Shell $ python
  • 52. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
  • 53. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> prompt
  • 54. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> prompt means that your turn!
  • 55. Interactive Shell $
  • 56. Interactive Shell $ python
  • 57. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>>
  • 58. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 1 + 2 + 3
  • 59. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 1 + 2 + 3 6 >>>
  • 60. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 1 + 2 + 3 6 >>> “Hello World”
  • 61. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 1 + 2 + 3 6 >>> “Hello World” ‘Hello World’ >>>
  • 62. Interactive Shell $ python Python 2.7.5 (default, May 20 2013, 23:41:46) [GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> 1 + 2 + 3 6 >>> “Hello World” ‘Hello World’ >>> x = 100
  • 63. Interactive Shell Python 2.7.5 (default, May 20 2013, $ python 23:41:46) Python 2.7.5 (default, May 20 2013, [GCC 4.2.1 23:41:46) Compatible Apple LLVM 4.2 (clang-425.0.28)] on Apple [GCC 4.2.1 Compatibledarwin LLVM 4.2 Type "help", "copyright", "credits" or (clang-425.0.28)] on darwin "license" for more information. Type "help", "copyright", "credits" or >>> 1 + 2 + 3 "license" for more information. 6 >>> 1 + 2 + 3 >>> “Hello World” 6 ‘Hello World’ >>> “Hello World” >>> x ‘Hello=World’ 100 >>> x = 100
  • 64. Interactive Shell Python 2.7.5 (default, May 20 2013, $ python 23:41:46) Python 2.7.5 (default, May 20 2013, [GCC 4.2.1 23:41:46) Compatible Apple LLVM 4.2 (clang-425.0.28)] on Apple [GCC 4.2.1 Compatibledarwin LLVM 4.2 Type "help", "copyright", "credits" or (clang-425.0.28)] on darwin "license" for more information. Type "help", "copyright", "credits" or >>> 1 + 2 + 3 "license" for more information. 6 >>> 1 + 2 + 3 >>> “Hello World” 6 ‘Hello World’ >>> “Hello World” >>> x ‘Hello=World’ 100 >>> x = 100 y 200
  • 65. Interactive Shell 23:41:46) Python 2.7.5 (default, May 20 2013, $ python [GCC 4.2.1 23:41:46) Compatible May LLVM 4.2 Python 2.7.5 (default,Apple20 2013, (clang-425.0.28)] on Apple [GCC 4.2.1 23:41:46) Compatibledarwin LLVM 4.2 Type "help", "copyright", "credits" (clang-425.0.28)] on Apple [GCC 4.2.1 Compatibledarwin LLVM 4.2or "license" for more information. Type "help", "copyright", "credits" or (clang-425.0.28)] on darwin >>> "license" for more information. Type1"help",3"copyright", "credits" or + 2 + 6 >>> 1 + 2 + 3 "license" for more information. 6 >>> “Hello+World” 1 + 2 3 ‘Hello World’ >>> “Hello World” 6 ‘Hello=World’ >>> “Hello World” x 100 >>> x ‘Hello=World’ y 200 100 >>> x = 100 y 200
  • 66. Interactive Shell 23:41:46) Python 2.7.5 (default, May 20 2013, $ python [GCC 4.2.1 23:41:46) Compatible May LLVM 4.2 Python 2.7.5 (default,Apple20 2013, (clang-425.0.28)] on Apple [GCC 4.2.1 23:41:46) Compatibledarwin LLVM 4.2 Type "help", "copyright", "credits" (clang-425.0.28)] on Apple [GCC 4.2.1 Compatibledarwin LLVM 4.2or "license" for more information. Type "help", "copyright", "credits" or (clang-425.0.28)] on darwin >>> "license" for more information. Type1"help",3"copyright", "credits" or + 2 + 6 >>> 1 + 2 + 3 "license" for more information. 6 >>> “Hello+World” 1 + 2 3 ‘Hello World’ >>> “Hello World” 6 ‘Hello=World’ >>> “Hello World” x 100 >>> x ‘Hello=World’ y 200 100 >>> x = y y + 100 200
  • 67. Interactive Shell (clang-425.0.28)] on darwin 23:41:46) Python 2.7.5 (default, May 20 2013, $ python Type "help", "copyright", [GCC 4.2.1 23:41:46) Compatible May"credits" Python 2.7.5 (default,Apple20 2013, or LLVM 4.2 "license" (clang-425.0.28)] information. [GCC 4.2.1 Compatible Apple 23:41:46) for moreon darwin LLVM 4.2 >>> Type "help",3"copyright", "credits" (clang-425.0.28)] on Apple [GCC14.2.1+Compatibledarwin LLVM 4.2or + 2 6 "license" for more information. Type "help", "copyright", "credits" or (clang-425.0.28)] on darwin >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or + 2 ‘Hello 2 + 3 6 >>> 1 +World’ "license" for more information. 6 >>> “Hello+World” x + 2 1 = 100 3 ‘Hello=World’ >>> “Hello World” 6 y 200 ‘Hello=World’ >>> “Hello World” x + y 100 300 y >>> x ‘Hello=World’ 200 100 >>> x = y y + 100 200
  • 68. Interactive Shell (clang-425.0.28)] on darwin 23:41:46) Python 2.7.5 (default, May 20 2013, $ python Type "help", "copyright", [GCC 4.2.1 23:41:46) Compatible May"credits" Python 2.7.5 (default,Apple20 2013, or LLVM 4.2 "license" (clang-425.0.28)] information. [GCC 4.2.1 Compatible Apple 23:41:46) for moreon darwin LLVM 4.2 >>> Type "help",3"copyright", "credits" (clang-425.0.28)] on Apple [GCC14.2.1+Compatibledarwin LLVM 4.2or + 2 6 "license" for more information. Type "help", "copyright", "credits" or (clang-425.0.28)] on darwin >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or + 2 ‘Hello 2 + 3 6 >>> 1 +World’ "license" for more information. 6 >>> “Hello+World” x + 2 1 = 100 3 ‘Hello=World’ >>> “Hello World” 6 y 200 ‘Hello=World’ >>> “Hello World” x + y 100 300 y >>> x ‘Hello=World’ 200 100 >>> for y in range(5): y + 100 x = i 200
  • 69. Interactive Shell Type "help", "copyright", (clang-425.0.28)] on darwin20 2013, 23:41:46) Python 2.7.5 (default, May"credits" or $ python "license" Type "help", more information. [GCC 4.2.1 Compatible May LLVM 4.2 23:41:46) for"copyright", "credits" Python 2.7.5 (default,Apple20 2013, or >>> "license" (clang-425.0.28)] information. [GCC14.2.1+Compatible Apple 23:41:46) for moreon darwin LLVM 4.2 + 2 3 6 >>> Type "help",3"copyright", "credits" (clang-425.0.28)] on Apple [GCC14.2.1+Compatibledarwin LLVM 4.2or + 2 >>> "help", more 6 "license" World” information. Type“Hellofor"copyright", "credits" or (clang-425.0.28)] on darwin ‘Hello+World’ >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or 2 ‘Hello+ 100 3 6 >>> 1 =World’ "license" for more information. x 2 + 6 >>> “Hello+World” y x + 200 1 = 100 3 2 ‘Hello=World’ >>> “Hello World” 6 x y + y 200 300 x + y ‘Hello=World’ >>> “Hello World” 100 300 x >>> for i in ‘Hello=World’range(5): y 200 100 ... x = i >>> for y in range(5): y + 100 200
  • 70. Interactive Shell Type "help", "copyright", (clang-425.0.28)] on darwin20 2013, 23:41:46) Python 2.7.5 (default, May"credits" or $ python "license" Type "help", more information. [GCC 4.2.1 Compatible May LLVM 4.2 23:41:46) for"copyright", "credits" Python 2.7.5 (default,Apple20 2013, or >>> "license" (clang-425.0.28)] information. [GCC14.2.1+Compatible Apple 23:41:46) for moreon darwin LLVM 4.2 + 2 3 6 >>> Type "help",3"copyright", "credits" (clang-425.0.28)] on Apple [GCC14.2.1+Compatibledarwin LLVM 4.2or + 2 >>> "help", more 6 "license" World” information. Type“Hellofor"copyright", "credits" or (clang-425.0.28)] on darwin ‘Hello+World’ >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or 2 ‘Hello+ 100 3 6 >>> 1 =World’ "license" for more information. x 2 + 6 >>> “Hello+World” y x + 200 1 = 100 3 2 ‘Hello=World’ >>> “Hello World” 6 x y + y 200 300 x + y ‘Hello=World’ >>> “Hello World” 100 300 x >>> for i in ‘Hello=World’range(5): y 200 100 ... x = y in i >>> for printrange(5): y + i 200 100
  • 71. Interactive Shell "license" Type "help", more information. (clang-425.0.28)] on darwin 23:41:46) Python 2.7.5 "copyright", 20 2013, $ python for(default, May"credits" or >>> "license" Type "help", more information. [GCC14.2.1+Compatible May LLVM 4.2 23:41:46) for"copyright", "credits" Python+2.7.53(default,Apple20 2013, or 2 6 >>> "license" (clang-425.0.28)] information. [GCC14.2.1+Compatible Apple 23:41:46) for moreon darwin LLVM 4.2 + 2 3 6 >>> "help",3"copyright", "credits" Type14.2.1 Compatible Apple (clang-425.0.28)] [GCC“Hello+World” on darwin LLVM 4.2or + 2 ‘Hello World’ >>> "help", more 6 "license" World” information. Type“Hellofor"copyright", "credits" or (clang-425.0.28)] on darwin ‘Hello=World’ >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or x + 100 2 ‘Hello+ 100 3 6 >>> 1 =World’ "license" for more information. y x 200 2 + 6 >>> “Hello+World” y x + 100 3 1 = y 200 2 300 y + y ‘Hello=World’ >>> “Hello World” 6 x 200 300 for y World” ‘Hello=World’ >>> “Helloin range(5): x + i 100 ... y 300 x >>> for print i ‘Hello=World’range(5): i in 200 100 ... x = y in i >>> for printrange(5): y + i 200 100
  • 72. Interactive Shell >>> "license" Typey"help", (clang-425.0.28)] information. 23:41:46) for moreon darwin Python=2.7.5 "copyright", 20 2013, $ python200 (default, May"credits" or >>> "license" Typex"help", more information. [GCC14.2.1+Compatible May LLVM 4.2 23:41:46) for"copyright", "credits" Python+2.7.53(default,Apple20 2013, or y 2 300 6 >>> "license" (clang-425.0.28)] information. [GCC14.2.1+Compatible Apple 23:41:46) for moreon darwin LLVM 4.2 + 2 3 6 >>> 14.2.1 Compatible Typefor i +World” (clang-425.0.28)] on darwin [GCC“Helloin3range(5):Apple LLVM 4.2or "help", "copyright", "credits" + 2 ... ‘Hello World’ more >>> "help", i 6 "license" World” information. Type“Hellofor"copyright", "credits" or (clang-425.0.28)] on darwin print ... x + 100 ‘Hello=World’ >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or 2 0 ‘Hello+ 100 3 6 >>> 1 =World’ "license" for more information. y x 200 2 + 1 6 >>> “Hello+World” y x + 100 3 1 = y 200 2 2 300 y + y ‘Hello=World’ >>> “Hello World” 6 x 200 3 300 for y World” ‘Hello=World’ >>> “Helloin range(5): x + i 100 4 ... y 300 x >>> for print i ‘Hello=World’range(5): i in 200 100 ... x = y in i >>> for printrange(5): y + i 200 100
  • 73. Interactive Shell >>> "license" Typey"help", (clang-425.0.28)] information. 23:41:46) for moreon darwin Python=2.7.5 "copyright", 20 2013, $ python200 (default, May"credits" or >>> "license" Typex"help", more information. [GCC14.2.1+Compatible May LLVM 4.2 23:41:46) for"copyright", "credits" Python+2.7.53(default,Apple20 2013, or y 2 300 6 >>> "license" (clang-425.0.28)] information. [GCC14.2.1+Compatible Apple 23:41:46) for moreon darwin LLVM 4.2 + 2 3 6 >>> 14.2.1 Compatible Typefor i +World” (clang-425.0.28)] on darwin [GCC“Helloin3range(5):Apple LLVM 4.2or "help", "copyright", "credits" + 2 ... ‘Hello World’ more >>> "help", i 6 "license" World” information. Type“Hellofor"copyright", "credits" or (clang-425.0.28)] on darwin print ... x + 100 ‘Hello=World’ >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or 2 0 ‘Hello+ 100 3 6 >>> 1 =World’ "license" for more information. y x 200 2 + 1 6 >>> “Hello+World” y x + 100 3 1 = y 200 2 2 300 y + y ‘Hello=World’ >>> “Hello World” 6 x 200 3 300 for y World” ‘Hello=World’ >>> “Helloin range(5): x + i 100 4 ... y 300 x >>> for print i ‘Hello=World’range(5): i in 200 100 ... x = y in i >>> for printrange(5): exit() y + i 200 100
  • 74. Interactive Shell >>> x + 200 "license" Typey"help", more information. (clang-425.0.28)] on darwin 23:41:46) Python=2.7.5 "copyright", 20 2013, $ pythony for(default, May"credits" or 300 >>> "license" Typex"help", more information. [GCC14.2.1+Compatible May LLVM 4.2 23:41:46) for"copyright", "credits" Python+2.7.53(default,Apple20 2013, or y 2 300 6 >>> 14.2.1 "license" +Compatible (clang-425.0.28)] information. [GCCfor i for moreon darwin 23:41:46) in3range(5):Apple LLVM 4.2 + 2 ... "help", i 6 >>> 14.2.1+World” Typefor print"copyright", "credits" (clang-425.0.28)] on darwin [GCC“Helloin3range(5):Apple LLVM 4.2or + i Compatible 2 ... ‘Hello World’ more >>> "help", i 6 "license" World” information. Type“Hellofor"copyright", "credits" or (clang-425.0.28)] on darwin print 0 ... x + 100 ‘Hello=World’ >>> 1"help",3 more "license" +World” information. Type“Hellofor"copyright", "credits" or 2 1 0 ‘Hello+ 100 3 6 >>> 1 =World’ "license" for more information. y x 200 2 + 2 1 6 >>> “Hello+World” y x + 100 3 1 = y 200 2 3 2 300 y + y ‘Hello=World’ >>> “Hello World” 6 x 200 4 3 300 for y World” ‘Hello=World’ >>> “Helloin range(5): x + i 100 4 ... y 300 x >>> for print i ‘Hello=World’range(5): exit()in i 200 100 $ ... x = y in i >>> for printrange(5): exit() y + i 200 100
  • 75. Hello World!
  • 76. Hello World! if __name__ == “__main__”: print “Hello World!” helloworld.py
  • 77. Hello World! $
  • 78. Hello World! $ python helloworld.py
  • 79. Hello World! $ python helloworld.py Hello World! $
  • 80. A Python Code
  • 81. A Python Code def mul(x, y): ret = x * y return ret for i in range(10)[2:]: for j in range(10)[1:]: print "{0} x {1} = {2}".format(i, j, mul(i, j)) 9x9table.py
  • 82. script language def mul(x, y): ret = x * y return ret for i in range(10)[2:]: for j in range(10)[1:]: print "{0} x {1} = {2}".format(i, j, mul(i, j)) no specified entry point
  • 83. script language $
  • 84. script language $ python 9x9table.py
  • 85. script language 8 7 6 5 4 3 2 $ 8 7 6 5 4 3 2 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 2 9 8 7 6 5 4 3 9 8 7 6 5 4 3 $ 9 8 7 6 5 4 3 x 1 = 4 python29x9table.py 9 8 7 6 5 4 3 2 63 56 49 7 54 48 42 45 40 35 30 25 5 36 32 28 20 27 24 21 15 9 3 18 16 14 12 10 8 6 x 1 = 2 9 8 7 6 5 4 3 2 64 63 56 49 7 54 48 42 45 40 35 30 25 5 36 32 28 20 27 24 21 15 9 3 18 16 14 12 10 8 6 4 x 2 = 4 1 9 8 7 6 5 4 3 72 64 63 56 49 7 54 48 42 45 40 35 30 25 5 36 32 28 20 27 24 21 15 9 3 18 16 14 12 10 8 6 x 3 = 6 2 1 9 8 7 6 5 4 72 64 63 56 49 7 54 48 42 45 40 35 30 25 5 36 32 28 20 4 27 24 21 15 9 3 18 16 14 12 10 8 x 4 = 8 3 2 1 9 8 7 6 5 72 64 63 56 49 7 54 48 42 45 40 35 30 25 5 36 32 28 20 4 27 24 21 15 9 6 3 18 16 14 12 10 x 5 = 10 4 3 2 1 9 8 7 6 72 64 63 56 49 7 54 48 42 45 40 35 30 25 5 36 32 28 20 8 4 27 24 21 15 9 6 3 18 16 14 12 x 6 = 12 5 4 3 2 1 9 8 7 72 64 63 56 49 7 54 48 42 45 40 35 30 25 10 5 36 32 28 20 8 4 27 24 21 15 9 6 3 18 16 14 x 7 = 14 6 5 4 3 2 1 9 8 72 64 63 56 49 7 54 48 42 45 40 35 30 25 10 5 36 32 28 20 8 4 27 24 21 15 12 9 6 3 18 16 x 8 = 16 7 6 5 4 3 2 1 9 72 64 63 56 49 14 7 54 48 42 45 40 35 30 25 10 5 36 32 28 20 8 4 27 24 21 15 12 9 6 3 18 x 9 = 18 8 7 6 5 4 3 2 1 72 64 63 56 49 14 7 54 48 42 45 40 35 30 25 10 5 36 32 28 20 16 8 4 27 24 21 15 12 9 6 3 x 1 = 3 9 8 7 6 5 4 3 2 72 64 63 56 49 14 7 54 48 42 45 40 35 30 25 10 5 36 32 28 20 16 8 4 27 24 21 18 15 12 9 6 x 2 = 6 1 9 8 7 6 5 4 3 81 72 64 63 56 49 14 7 54 48 42 45 40 35 30 25 10 5 36 32 28 20 16 8 4 27 24 21 18 15 12 9 x 3 = 9 2 1 9 8 7 6 5 4 81 72 64 63 56 49 14 7 54 48 42 6 45 40 35 30 25 10 5 36 32 28 20 16 8 4 27 24 21 18 15 12
  • 86. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!”
  • 87. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!”
  • 88. If you need a main function as entry point, if __name__ == “__main__”: print “Hello World!” and write all statements after it.
  • 89. variable def mul(x, y): ret = x * y return ret for i in range(10)[2:]: for j in range(10)[1:]: print "{0} x {1} = {2}".format(i, j, mul(i, j)) can be used without declaration
  • 90. variable def mul(x, y): ret = x * y return ret for i in range(10)[2:]: for j in range(10)[1:]: print "{0} x {1} = {2}".format(i, j, mul(i, j)) can be used without declaration
  • 91. scope def mul(x, y): ret = x * y return ret for i in range(10)[2:]: for j in range(10)[1:]: print "{0} x {1} = {2}".format(i, j, mul(i, j)) use whitespace to identify scope
  • 92. scope def mul(x, y): ret = x * y return ret for i in range(10)[2:]: for j in range(10)[1:]: print "{0} x {1} = {2}".format(i, j, mul(i, j)) use whitespace to identify scope
  • 93. You can use to identify scopes.
  • 94. You can use one space two spaces three spaces four spaces lots of spaces to identify scopes.
  • 95. You can use one space one tab two spaces two tabs three spaces three tabs four spaces four tabs lots of spaces lots of tabs to identify scopes.
  • 96. But, you should unify the style!
  • 97. Built-in Data Type
  • 98. Null >>> None
  • 99. Null >>> None None
  • 100. Null None >>> None >>>
  • 101. Boolean >>> True False
  • 102. Boolean >>> 1 == 1 True False
  • 103. Boolean True False >>> 1 == 1 True >>>
  • 104. Boolean True False >>> 1 == 1 True >>> 1 != 1
  • 105. Boolean True False >>> 1 == 1 True >>> 1 != 1 False >>>
  • 106. Boolean True False >>> 1 == 1 True >>> 1 != 1 False >>> True
  • 107. Boolean True False >>> 1 == 1 True >>> 1 != 1 False >>> True True >>>
  • 108. Boolean True False >>> 1 == 1 True >>> 1 != 1 False >>> True True >>> False
  • 109. Boolean True False True >>> 1 == 1 >>> True1 != 1 False >>> 1 != 1 >>> True False True >>> True >>> TrueFalse False >>> False >>>
  • 110. Boolean >>> True False
  • 111. Boolean upper case >>> True False
  • 112. Boolean upper case >>> true True False
  • 113. Boolean upper case True False >>> true Traceback (most recent call last): File "<input>", line 1, in <module> NameError: name 'true' is not defined >>>
  • 114. Initialization / Conversion >>> True False
  • 115. Initialization / Conversion >>> bool(1) True False
  • 116. Initialization / Conversion True False >>> bool(1) True >>>
  • 117. Initialization / Conversion True False >>> bool(1) True >>> bool(True)
  • 118. Initialization / Conversion True False >>> bool(1) True >>> bool(True) True >>>
  • 119. Initialization / Conversion True False >>> bool(1) True >>> bool(True) True >>> bool()
  • 120. Initialization / Conversion True False >>> bool(1) True >>> bool(True) True >>> bool() False >>>
  • 121. Logical Operators >>> and and or or not not
  • 122. Logical Operators >>> (1 == 1) and True and and or or not not
  • 123. Logical Operators and and or or not not >>> (1 == 1) and True True >>>
  • 124. Logical Operators and and or or not not >>> (1 == 1) and True True >>> (1 == 1) or False
  • 125. Logical Operators and and or or not not >>> (1 == 1) and True True >>> (1 == 1) or False True >>>
  • 126. Logical Operators and and or or not not >>> (1 == 1) and True True >>> (1 == 1) or False True >>> not (1 == 1)
  • 127. Logical Operators and and or or not not >>> (1 == 1) and True True >>> (1 == 1) or False True >>> not (1 == 1) False >>>
  • 128. Numbers int (integer) long (long integer) float (real number) complex (complex number) 10 10L 100.0 3 + 2j -789 -789L -21.9 3 - 2j -0x111 0xFFFFFFFFF 3.20E+10 45j 0x69 -0x12321L -2.00E-08 3e+26j
  • 129. Initialization / Conversion data type initial >>> int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 130. Initialization / Conversion data type initial >>> int(10) int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 131. Initialization / Conversion data type initial >>> int(10) 10 >>> int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 132. Initialization / Conversion data type initial >>> int(10) 10 >>> int(“100”) int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 133. Initialization / Conversion data type initial >>> int(10) 10 >>> int(“100”) 100 >>> int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 134. Initialization / Conversion data type initial >>> int(10) 10 >>> int(“100”) 100 >>> complex(10) int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 135. Initialization / Conversion data type initial >>> int(10) 10 >>> int(“100”) 100 >>> complex(10) (10+0j) >>> int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 136. Initialization / Conversion data type initial >>> int(10) 10 >>> int(“100”) 100 >>> complex(10) (10+0j) >>> complex(10, 3) int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 137. Initialization / Conversion data type initial 10 >>> int(10) >>> 10 int(“100”) 100 >>> int(“100”) >>> 100 complex(10) (10+0j) >>> complex(10) >>> complex(10, 3) (10+0j) (10+3j) >>> complex(10, 3) >>> int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 138. Initialization / Conversion data type initial 10 >>> int(10) >>> 10 int(“100”) 100 >>> int(“100”) >>> 100 complex(10) (10+0j) >>> complex(10) >>> complex(10, 3) (10+0j) (10+3j) >>> complex(10, 3) >>> complex(“20+5j”) int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 139. Initialization / Conversion data type initial 100 10 >>> int(10) >>> complex(10) 10 int(“100”) (10+0j) 100 >>> int(“100”) >>> complex(10, 100 complex(10) 3) (10+3j) (10+0j) >>> complex(10) >>> complex(10, 3) (10+0j) complex(“20+5j”) (20+5j) (10+3j) >>> complex(10, 3) >>> complex(“20+5j”) int int(x) long long(x) float float(x) complex complex(x) complex(x, y)
  • 140. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>>
  • 141. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>> 2**10
  • 142. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>> 2**10 1024 >>>
  • 143. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>> 2**10 1024 >>> 5.8 // 2
  • 144. Arithmetic Operators + addition - subtraction * multiplication / division % modular ** exponential // floor division >>> 2**10 1024 >>> 5.8 // 2 2.0 >>>
  • 145. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>>
  • 146. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>> 3 & 1
  • 147. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>> 3 & 1 1 >>>
  • 148. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>> 3 & 1 1 >>> 1 << 10
  • 149. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>> 3 & 1 1 >>> 1 << 10 1024 >>>
  • 150. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>> 3 & 1 1 >>> 1 << 10 1024 >>> ~0
  • 151. Bitwise Operators & and | or ^ exclusion or >> shift right << shift left ~ not >>> 3 & 1 1 >>> 1 << 10 1024 >>> ~0 -1 >>>
  • 152. Comparison Operators > >= < <= == != greater than greater than or equal to less than less than or equal to equal to not equal to
  • 153. String Contents are surrounded by single quote or double quote. >>>
  • 154. String Contents are surrounded by single quote or double quote. >>> “Hello World”
  • 155. String Contents are surrounded by single quote or double quote. >>> “Hello World” ‘Hello World’ >>>
  • 156. String Contents are surrounded by single quote or double quote. >>> “Hello World” World!” ‘Hello World’ >>> ‘Hello World!’
  • 157. String Contents are surrounded by single quote or double quote. >>> “Hello World” World!” ‘Hello World’ >>> ‘Hello World!’ ‘Hello World’ >>>
  • 158. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>>
  • 159. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello
  • 160. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ...
  • 161. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ... World!”””
  • 162. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ... World!””” ‘HellonWorld!’ >>>
  • 163. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ... World!””” ‘HellonWorld!’ >>> x = “““Hello
  • 164. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ... World!””” ‘HellonWorld!’ >>> x = “““Hello ...
  • 165. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ... World!””” ‘HellonWorld!’ >>> x = “““Hello ... World!”””
  • 166. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ... World!””” ‘HellonWorld!’ >>> x = “““Hello ... World!””” >>>
  • 167. Cross-line String Contents are surrounded by three single quotes or three double quotes. >>> “““Hello ... World!””” ‘HellonWorld!’ >>> x = “““Hello ... World!””” >>> print x
  • 168. Cross-line String Contents are surrounded by three single quotes or three double quotes. ... World!””” >>> “““Hello ‘HellonWorld!’ ... World!””” >>> x = “““Hello ‘HellonWorld!’ ... x = “““Hello >>> World!””” >>> print x ... World!””” Hello >>> print x World! >>>
  • 169. Initialization / Conversion >>>
  • 170. Initialization / Conversion >>> str(“I’m string”)
  • 171. Initialization / Conversion >>> str(“I’m string”) “I’m string” >>>
  • 172. Initialization / Conversion >>> str(“I’m string”) “I’m string” >>> str(100)
  • 173. Initialization / Conversion >>> str(“I’m string”) “I’m string” >>> str(100) ‘100’ >>>
  • 174. Initialization / Conversion >>> str(“I’m string”) “I’m string” >>> str(100) ‘100’ >>> str(complex(10, 3))
  • 175. Initialization / Conversion >>> str(“I’m string”) “I’m string” >>> str(100) ‘100’ >>> str(complex(10, 3)) ‘(10+3j)’ >>>
  • 176. Operators >>> + concatenate * repeat
  • 177. Operators >>> x = “abc” + concatenate * repeat
  • 178. Operators >>> x = “abc” >>> + concatenate * repeat
  • 179. Operators >>> x = “abc” >>> ‘(’ + x + ‘)’ + concatenate * repeat
  • 180. Operators + concatenate * repeat >>> x = “abc” >>> ‘(’ + x + ‘)’ ‘(abc)’ >>>
  • 181. Operators + concatenate * repeat >>> x = “abc” >>> ‘(’ + x + ‘)’ ‘(abc)’ >>> x * 3
  • 182. Operators + concatenate * repeat >>> x = “abc” >>> ‘(’ + x + ‘)’ ‘(abc)’ >>> x * 3 ‘abcabcabc’ >>>
  • 183. Operators + concatenate * repeat >>> x = “abc” >>> ‘(’ + x + ‘)’ ‘(abc)’ >>> x * 3 ‘abcabcabc’ >>> ‘(’ + x * 3 + ‘)’
  • 184. Operators + concatenate * repeat >>> x = “abc” ‘abc’ >>> ‘(’ + x + ‘)’ ‘(abc)’ >>> x * 3 ‘abcabcabc’ >>> ‘(’ + x * 3 + ‘)’ ‘(abcabcabc)’ >>>
  • 185. Operators + concatenate * repeat >>> x = “abc” ‘abc’ >>> ‘(’ + x + ‘)’ ‘(abc)’ >>> x * 3 ‘abcabcabc’ >>> ‘(’ + x * 3 + ‘)’ ‘(abcabcabc)’ >>> (x + ‘d’) * 3
  • 186. Operators + concatenate * repeat ‘(abc)’ ‘abc’ >>> x = “abc” >>> ‘(’ + x + ‘)’ x * 3 ‘abcabcabc’ ‘(abc)’ >>> ‘(’ + x * 3 + ‘)’ x * 3 ‘(abcabcabc)’ ‘abcabcabc’ >>> ‘(’++‘d’) * 3 ‘)’ (x x * 3 + ‘abcdabcdabcd’ ‘(abcabcabc)’ >>> (x + ‘d’) * 3
  • 187. Access Character >>>
  • 188. Access Character >>> x = ‘0123456789’
  • 189. Access Character >>> x = ‘0123456789’ >>>
  • 190. Access Character >>> x = ‘0123456789’ >>> x[1]
  • 191. Access Character >>> x = ‘0123456789’ >>> x[1] ‘1’ >>>
  • 192. Access Character >>> x = ‘0123456789’ >>> x[1] ‘1’ >>> x[1] = ‘0’
  • 193. Access Character >>> x = ‘0123456789’ >>> x[1] ‘1’ >>> x[1] = ‘0’ >>>
  • 194. Access Character >>> >>> ‘1’ >>> >>> x = ‘0123456789’ x[1] x[1] = ‘0’ x
  • 195. Access Character >>> x = ‘0123456789’ >>> x[1] ‘1’ >>> x[1] = ‘0’ >>> x ‘0023456789’ >>>
  • 196. substring >>> [start:end(:step)]
  • 197. substring >>> [start:end(:step)] default value [0:length(:1)]
  • 198. substring >>> x = “0123456789” [start:end(:step)] default value [0:length(:1)]
  • 199. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>>
  • 200. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>> x[::]
  • 201. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>> x[::] ‘0123456789’ >>>
  • 202. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>> x[::] ‘0123456789’ >>> x[:]
  • 203. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>> x[::] ‘0123456789’ >>> x[:] ‘0123456789’ >>>
  • 204. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>> x[::] ‘0123456789’ >>> x[:] ‘0123456789’ >>> x[1:4]
  • 205. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>> x[::] ‘0123456789’ >>> x[:] ‘0123456789’ >>> x[1:4] ‘123’ >>>
  • 206. substring [start:end(:step)] default value [0:length(:1)] >>> x = “0123456789” >>> x[::] ‘0123456789’ >>> x[:] ‘0123456789’ >>> x[1:4] ‘123’ >>> x[1:-1]
  • 207. substring [start:end(:step)] default value [0:length(:1)] ‘0123456789’ >>> x = “0123456789” >>> x[::] x[:] ‘0123456789’ >>> x[:] x[1:4] ‘123’ ‘0123456789’ >>> x[1:4] x[1:-1] ‘12345678’ ‘123’ >>> x[1:-1]
  • 208. substring [start:end(:step)] default value [0:length(:1)] ‘0123456789’ >>> x = “0123456789” >>> x[::] x[:] ‘0123456789’ >>> x[:] x[1:4] ‘123’ ‘0123456789’ >>> x[1:4] x[1:-1] ‘12345678’ ‘123’ >>> x[1:-1] x[::2]
  • 209. substring [start:end(:step)] default value [0:length(:1)] ‘0123456789’ >>> x = “0123456789” >>> x[::] x[1:4] x[:] ‘123’ ‘0123456789’ >>> x[:] x[1:-1] x[1:4] ‘12345678’ ‘123’ ‘0123456789’ >>> x[1:4] x[::2] x[1:-1] ‘02468’ ‘12345678’ ‘123’ >>> x[1:-1] x[::2]
  • 210. substring [start:end(:step)] default value [0:length(:1)] ‘0123456789’ >>> x = “0123456789” >>> x[::] x[1:4] x[:] ‘123’ ‘0123456789’ >>> x[:] x[1:-1] x[1:4] ‘12345678’ ‘123’ ‘0123456789’ >>> x[1:4] x[::2] x[1:-1] ‘02468’ ‘12345678’ ‘123’ >>> x[1:-1] x[::-1] x[::2]
  • 211. substring [start:end(:step)] default value [0:length(:1)] ‘123’ ‘0123456789’ >>> x = “0123456789” >>> x[::] x[1:-1] x[1:4] x[:] ‘12345678’ ‘123’ ‘0123456789’ >>> x[:] x[::2] x[1:-1] x[1:4] ‘02468’ ‘12345678’ ‘123’ ‘0123456789’ >>> x[1:4] x[::-1] x[::2] x[1:-1] ‘9876543210’ ‘02468’ ‘12345678’ ‘123’ >>> x[1:-1] x[::-1] x[::2]
  • 212. length of string >>> len(string)
  • 213. length of string >>> x = ‘0123456789’ len(string)
  • 214. length of string len(string) >>> x = ‘0123456789’ >>>
  • 215. length of string len(string) >>> x = ‘0123456789’ >>> len(x)
  • 216. length of string len(string) >>> x = ‘0123456789’ >>> len(x) 10 >>>
  • 217. length of string len(string) >>> x = ‘0123456789’ >>> len(x) 10 >>> len(x[::2])
  • 218. length of string len(string) >>> x = ‘0123456789’ >>> len(x) 10 >>> len(x[::2]) 5 >>>
  • 219. List Contents are surrounded by square brackets and separate by comma. >>>
  • 220. List Contents are surrounded by square brackets and separate by comma. >>> [“aaa”, “bbb”, 1, 2]
  • 221. List Contents are surrounded by square brackets and separate by comma. >>> [“aaa”, “bbb”, 1, 2] [‘aaa’, ‘bbb’, 1, 2] >>>
  • 222. Initialization / Conversion >>>
  • 223. Initialization / Conversion >>> list([1, 2, 3])
  • 224. Initialization / Conversion >>> list([1, 2, 3]) [1, 2, 3] >>>
  • 225. Initialization / Conversion >>> list([1, 2, 3]) [1, 2, 3] >>> list(“abc”)
  • 226. Initialization / Conversion >>> list([1, 2, 3]) [1, 2, 3] >>> list(“abc”) [‘a’, ‘b’, ‘c’] >>>
  • 227. Operators >>> + append * repeat
  • 228. Operators >>> x = [1, 2, 3] + append * repeat
  • 229. Operators >>> x = [1, 2, 3] >>> + append * repeat
  • 230. Operators >>> x = [1, 2, 3] >>> y = [‘a’, ‘b’] + append * repeat
  • 231. Operators + append * repeat >>> x = [1, 2, 3] >>> y = [‘a’, ‘b’] >>>
  • 232. Operators + append * repeat >>> x = [1, 2, 3] >>> y = [‘a’, ‘b’] >>> x * 2
  • 233. Operators + append * repeat >>> >>> >>> [1, >>> x = [1, 2, 3] y = [‘a’, ‘b’] x * 2 2, 3, 1, 2, 3]
  • 234. Operators + append * repeat >>> >>> >>> [1, >>> x = [1, 2, 3] y = [‘a’, ‘b’] x * 2 2, 3, 1, 2, 3] x + y
  • 235. Operators + append * repeat >>> >>> >>> [1, >>> [1, >>> x = [1, 2, 3] y = [‘a’, ‘b’] x * 2 2, 3, 1, 2, 3] x + y 2, 3, ‘a’, ‘b’]
  • 236. Access Element >>>
  • 237. Access Element >>> x = [1, 2, 3, 4, 5]
  • 238. Access Element >>> x = [1, 2, 3, 4, 5] >>>
  • 239. Access Element >>> x = [1, 2, 3, 4, 5] >>> x[1]
  • 240. Access Element >>> x = [1, 2, 3, 4, 5] >>> x[1] 2 >>>
  • 241. Access Element >>> x = [1, 2, 3, 4, 5] >>> x[1] 2 >>> x[1] = ‘0’
  • 242. Access Element >>> x = [1, 2, 3, 4, 5] >>> x[1] 2 >>> x[1] = ‘0’ >>>
  • 243. Access Element >>> >>> 2 >>> >>> x = [1, 2, 3, 4, 5] x[1] x[1] = ‘0’ x
  • 244. Access Element >>> >>> 2 >>> >>> [1, >>> x = [1, 2, 3, 4, 5] x[1] x[1] = ‘0’ x ‘0’, 3, 4, 5]
  • 245. Slice >>> [start:end(:step)]
  • 246. Slice >>> [start:end(:step)] default value [0:length(:1)]
  • 247. Slice >>> x = [1, 2, 3, 4, 5] [start:end(:step)] default value [0:length(:1)]
  • 248. Slice [start:end(:step)] default value [0:length(:1)] >>> x = [1, 2, 3, 4, 5] >>>
  • 249. Slice [start:end(:step)] default value [0:length(:1)] >>> x = [1, 2, 3, 4, 5] >>> x[::]
  • 250. Slice [start:end(:step)] default value [0:length(:1)] >>> x = [1, 2, 3, 4, 5] >>> x[::] [1, 2, 3, 4, 5] >>>
  • 251. Slice [start:end(:step)] default value [0:length(:1)] >>> >>> [1, >>> x = [1, 2, 3, 4, 5] x[::] 2, 3, 4, 5] x[:]
  • 252. Slice [start:end(:step)] default value [0:length(:1)] >>> >>> [1, >>> [1, >>> x = [1, 2, 3, 4, 5] x[::] 2, 3, 4, 5] x[:] 2, 3, 4, 5]
  • 253. Slice [start:end(:step)] default value [0:length(:1)] >>> >>> [1, >>> [1, >>> x = [1, 2, 3, 4, 5] x[::] 2, 3, 4, 5] x[:] 2, 3, 4, 5] x[1:3]
  • 254. Slice [start:end(:step)] default value [0:length(:1)] >>> >>> [1, >>> [1, >>> [2, >>> x = [1, 2, 3, 4, 5] x[::] 2, 3, 4, 5] x[:] 2, 3, 4, 5] x[1:3] 3]
  • 255. Slice [start:end(:step)] default value [0:length(:1)] >>> >>> [1, >>> [1, >>> [2, >>> x = [1, 2, 3, 4, 5] x[::] 2, 3, 4, 5] x[:] 2, 3, 4, 5] x[1:3] 3] x[1:-1]
  • 256. Slice [start:end(:step)] default value [0:length(:1)] [1, >>> >>> [1, >>> [2, [1, >>> [2, >>> 2, [1, 5] x =3, 4,2, 3, 4, 5] x[:] x[::] 2, 3, 4, 5] x[1:3] x[:] 3] 2, 3, 4, 5] x[1:-1] x[1:3] 3, 3] 4] x[1:-1]
  • 257. Slice [start:end(:step)] default value [0:length(:1)] [1, >>> >>> [1, >>> [2, [1, >>> [2, >>> 2, [1, 5] x =3, 4,2, 3, 4, 5] x[:] x[::] 2, 3, 4, 5] x[1:3] x[:] 3] 2, 3, 4, 5] x[1:-1] x[1:3] 3, 3] 4] x[::2] x[1:-1]
  • 258. Slice [start:end(:step)] default value [0:length(:1)] [1, >>> >>> [2, [1, >>> [2, [1, >>> [1, [2, >>> 2, [1, 5] x =3, 4,2, 3, 4, 5] x[1:3] x[:] x[::] 3] 2, 3, 4, 5] x[1:-1] x[1:3] x[:] 3, 3] 4] 2, 3, 4, 5] x[::2] x[1:-1] x[1:3] 3, 5] 3] 4] x[::2] x[1:-1]
  • 259. Slice [start:end(:step)] default value [0:length(:1)] [1, >>> >>> [2, [1, >>> [2, [1, >>> [1, [2, >>> 2, [1, 5] x =3, 4,2, 3, 4, 5] x[1:3] x[:] x[::] 3] 2, 3, 4, 5] x[1:-1] x[1:3] x[:] 3, 3] 4] 2, 3, 4, 5] x[::2] x[1:-1] x[1:3] 3, 5] 3] 4] x[::-1] x[::2] x[1:-1]
  • 260. Slice [start:end(:step)] default value [0:length(:1)] [2, [1, >>> >>> [2, [1, >>> [2, [1, >>> [5, [1, [2, >>> 3] 2, [1, 5] x =3, 4,2, 3, 4, 5] x[1:-1] x[1:3] x[:] x[::] 3, 3] 4] 2, 3, 4, 5] x[::2] x[1:-1] x[1:3] x[:] 3, 5] 3] 4] 2, 3, 4, 5] x[::-1] x[::2] x[1:-1] x[1:3] 4, 3, 3, 5] 3] 4] 2, 1] x[::-1] x[::2] x[1:-1]
  • 261. length of list >>> len(list)
  • 262. length of list >>> x = [1, 2, 3, 4, 5] len(list)
  • 263. length of list len(list) >>> x = [1, 2, 3, 4, 5] >>>
  • 264. length of list len(list) >>> x = [1, 2, 3, 4, 5] >>> len(x)
  • 265. length of list len(list) >>> x = [1, 2, 3, 4, 5] >>> len(x) 5 >>>
  • 266. length of list len(list) >>> x = [1, 2, 3, 4, 5] >>> len(x) 5 >>> len(x[::2])
  • 267. length of list len(list) >>> x = [1, 2, 3, 4, 5] >>> len(x) 5 >>> len(x[::2]) 3 >>>
  • 268. Tuple >>> Immutable List
  • 269. Tuple >>> (1, ‘aaa’, 2) Immutable List
  • 270. Tuple >>> (1, ‘aaa’, 2) (1, ‘aaa’, 2) >>> Immutable List
  • 271. Tuple >>> (1, ‘aaa’, 2) (1, ‘aaa’, 2) >>> 1, ‘aaa’, 2 Immutable List
  • 272. Tuple Immutable List >>> (1, >>> (1, >>> (1, ‘aaa’, 2) ‘aaa’, 2) 1, ‘aaa’, 2 ‘aaa’, 2)
  • 273. Tuple Immutable List >>> (1, >>> (1, >>> (1, ‘aaa’, 2) ‘aaa’, 2) 1, ‘aaa’, 2 ‘aaa’, 2) x = (1, ‘aaa’, 2)
  • 274. Tuple Immutable List >>> (1, >>> (1, >>> >>> (1, ‘aaa’, 2) ‘aaa’, 2) 1, ‘aaa’, 2 ‘aaa’, 2) x = (1, ‘aaa’, 2)
  • 275. Tuple Immutable List >>> (1, >>> (1, >>> >>> (1, ‘aaa’, 2) ‘aaa’, 2) 1, ‘aaa’, 2 ‘aaa’, 2) x = (1, ‘aaa’, 2) x[1] = 3
  • 276. Tuple Immutable List >>> (1, ‘aaa’, 2) x[1] = 3 Traceback 2) (1, ‘aaa’,(most recent call last): >>> 1, ‘aaa’, 2 (1, ‘aaa’, 2) File "<input>", line 1, x <module> >>>in = (1, ‘aaa’, 2) TypeError: 'tuple' >>> x[1] = 3 object does not support item assignment
  • 277. Tuple Immutable List Traceback=(most recent >>> (1, ‘aaa’, 2) x[1] 3 call last): Traceback 2) (1, ‘aaa’,(most recent call last): >>> 1, ‘aaa’, 2 File "<input>", line 1,File "<input>", line (1,in <module> ‘aaa’, 2) TypeError: ‘aaa’, 1, x <module> >>>in = (1,'tuple' 2) object does TypeError: 'tuple' >>> x[1] = 3not support item assignment object does not support >>> item assignment
  • 278. Initialization / Conversion >>>
  • 279. Initialization / Conversion >>> tuple([1, 2, 3])
  • 280. Initialization / Conversion >>> tuple([1, 2, 3]) (1, 2, 3) >>>
  • 281. Access Element >>>
  • 282. Access Element >>> x = (1, 2, 3)
  • 283. Access Element >>> x = (1, 2, 3) >>>
  • 284. Access Element >>> x = (1, 2, 3) >>> x[1]
  • 285. Access Element >>> x = (1, 2, 3) >>> x[1] 2 >>>
  • 286. Access Element >>> x = (1, 2, 3) >>> x[1] 2 >>> a, b, c = x
  • 287. Access Element >>> x = (1, 2, 3) >>> x[1] 2 >>> a, b, c = x >>>
  • 288. Access Element >>> >>> 2 >>> >>> x = (1, 2, 3) x[1] a, b, c = x a
  • 289. Access Element >>> >>> 2 >>> >>> 1 >>> x = (1, 2, 3) x[1] a, b, c = x a
  • 290. Access Element >>> >>> 2 >>> >>> 1 >>> x = (1, 2, 3) x[1] a, b, c = x a b
  • 291. Access Element >>> 2 >>> >>> 2 >>> 1 >>> >>> 1 2 >>> >>> x[1] x = (1, 2, 3) x[1] a, b, c = x a a, b, c = x a b b
  • 292. Access Element >>> 2 >>> >>> 2 >>> 1 >>> >>> 1 2 >>> >>> x[1] x = (1, 2, 3) x[1] a, b, c = x a a, b, c = x a b b c
  • 293. Access Element >>> 2 >>> 1 >>> 2 >>> 2 1 >>> >>> 1 3 2 >>> >>> a, x[1](1, = x =b, c 2,x3) a x[1] a, b, c = x b a a, b, c = x a c b b c
  • 294. length of tuple >>> len(tuple)
  • 295. length of tuple >>> x = 1, 2, 3, 4, 5 len(tuple)
  • 296. length of tuple len(tuple) >>> x = 1, 2, 3, 4, 5 >>>
  • 297. length of tuple len(tuple) >>> x = 1, 2, 3, 4, 5 >>> len(x)
  • 298. length of tuple len(tuple) >>> x = 1, 2, 3, 4, 5 >>> len(x) 5 >>>
  • 299. Dictionary key-value relation key value >>>
  • 300. Dictionary key-value relation key value >>>
  • 301. Dictionary key-value relation key value >>> x = dict()
  • 302. Dictionary key-value relation key value >>> x = dict() >>>
  • 303. Dictionary key-value relation key value >>> x = dict() >>> x[‘abc’] = 123
  • 304. Dictionary key-value relation key value >>> x = dict() >>> x[‘abc’] = 123 >>>
  • 305. Dictionary key-value relation key value >>> x = dict() >>> x[‘abc’] = 123 >>> x[111] = ‘aaa’
  • 306. Dictionary key-value relation key value >>> x = dict() >>> x[‘abc’] = 123 >>> x[111] = ‘aaa’ >>>
  • 307. Dictionary key-value relation key value >>> >>> >>> >>> x = dict() x[‘abc’] = 123 x[111] = ‘aaa’ x
  • 308. Dictionary key-value relation key value >>> x = dict() >>> x[‘abc’] = 123 >>> x[111] = ‘aaa’ >>> x {‘abc’: 123, 111: ‘aaa’} >>>
  • 309. Dictionary key-value relation key value >>> x = dict() >>> x[‘abc’] = 123 >>> x[111] = ‘aaa’ >>> x {‘abc’: 123, 111: ‘aaa’} >>> {1: 20, 2: 30}
  • 310. Dictionary key-value relation key value >>> x = dict() >>> x[‘abc’] = 123 >>> x[111] = ‘aaa’ >>> x {‘abc’: 123, 111: ‘aaa’} >>> {1: 20, 2: 30} {1: 20, 2: 30} >>>
  • 311. Initialization / Conversion >>>
  • 312. Initialization / Conversion >>> dict()
  • 313. Initialization / Conversion >>> dict() {} >>>
  • 314. Initialization / Conversion >>> dict() {} >>> dict(one=1, two=2)
  • 315. Initialization / Conversion >>> dict() {} >>> dict(one=1, two=2) {‘one’: 1, ‘two’: 2} >>>
  • 316. Initialization / Conversion >>> dict() {} >>> dict(one=1, two=2) {‘one’: 1, ‘two’: 2} >>> dict([('two', 2), (‘one’: 1)])
  • 317. Initialization / Conversion >>> dict() {} >>> dict(one=1, two=2) {‘one’: 1, ‘two’: 2} >>> dict([('two', 2), (‘one’: 1)]) {‘one’: 1, ‘two’: 2} >>>
  • 318. Initialization / Conversion {} >>> dict() >>> {} dict(one=1, two=2) {‘one’: 1, ‘two’: 2} >>> dict(one=1, two=2) >>> dict([('two', 2} {‘one’: 1, ‘two’: 2), (‘one’: 1)]) >>> dict([('two', 2), {‘one’: 1, ‘two’: 2} (‘one’: 1)]) >>> dict({‘one’: 2} {‘one’: 1, ‘two’:1, ‘two’: 2}) >>> dict({‘one’: 1,
  • 319. Initialization / Conversion {‘one’: 1, {} >>> dict() ‘two’: 2} >>> dict([('two', 2), {} dict(one=1, two=2) (‘one’: 1, ‘two’: 2} {‘one’: 1)]) >>> dict(one=1, two=2) >>> dict([('two', 2} {‘one’: 1, ‘two’: 2), (‘one’: 1)]) >>> dict([('two',1, dict({‘one’: 2), ‘two’: 1, {‘one’: 1)]) (‘one’:2}) ‘two’: 2} >>> dict({‘one’: 2} {‘one’: 1, ‘two’:1, ‘two’: 2}) >>> dict({‘one’: 1,
  • 320. number of dictionary >>> len(dict)
  • 321. number of dictionary len(dict) >>> x = {‘one’: 1, ‘two’: 2}
  • 322. number of dictionary len(dict) >>> x = {‘one’: 1, ‘two’: 2} >>>
  • 323. number of dictionary len(dict) >>> x = {‘one’: 1, ‘two’: 2} >>> len(x)
  • 324. number of dictionary len(dict) >>> x = {‘one’: 1, ‘two’: 2} >>> len(x) 2 >>>
  • 325. Control
  • 326. Condition >>>
  • 327. Condition >>> x = 100
  • 328. Condition >>> x = 100 >>>
  • 329. Condition >>> x = 100 >>> if x > 100:
  • 330. Condition >>> x = 100 >>> if x > 100: ...
  • 331. Condition >>> x = 100 >>> if x > 100: ... x = x + 10
  • 332. Condition >>> x = 100 >>> if x > 100: ... x = x + 10 ...
  • 333. Condition >>> x = 100 >>> if x > 100: ... x = x + 10 ... elif x < 100:
  • 334. Condition >>> x = 100 >>> if x > 100: ... x = x + 10 ... elif x < 100: ...
  • 335. Condition >>> x = 100 >>> if x > 100: ... x = x + 10 ... elif x < 100: ... x = x - 10
  • 336. Condition >>> x = 100 >>> if x > 100: ... x = x + 10 ... elif x < 100: ... x = x - 10 ...
  • 337. Condition >>> >>> ... ... ... ... x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else:
  • 338. Condition >>> >>> ... ... ... ... ... x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else:
  • 339. Condition >>> >>> ... ... ... ... ... x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0
  • 340. Condition >>> >>> ... ... ... ... ... ... x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0
  • 341. Condition >>> >>> ... ... ... ... ... ... >>> x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0
  • 342. Condition >>> >>> ... ... ... ... ... ... >>> x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0 x
  • 343. Condition >>> >>> ... ... ... ... ... ... >>> 0 >>> x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0 x
  • 344. Condition >>> >>> ... ... ... ... ... ... >>> 0 >>> x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0 x
  • 345. Condition >>> >>> ... ... ... ... ... ... >>> 0 >>> x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0 x else if
  • 346. Condition >>> >>> ... ... ... ... ... ... >>> 0 >>> x = 100 if x > 100: x = x + 10 elif x < 100: x = x - 10 else: x = 0 no switch statement in Python x else if
  • 347. Loop >>>
  • 348. Loop >>> i = 0
  • 349. Loop >>> i = 0 >>>
  • 350. Loop >>> i = 0 >>> while i < 3:
  • 351. Loop >>> i = 0 >>> while i < 3: ...
  • 352. Loop >>> i = 0 >>> while i < 3: ... i = i + 1
  • 353. Loop >>> i = 0 >>> while i < 3: ... i = i + 1 ...
  • 354. Loop >>> i = 0 >>> while i < 3: ... i = i + 1 ... print i
  • 355. Loop >>> i = 0 >>> while i < 3: ... i = i + 1 ... print i ...
  • 356. Loop >>> i = 0 >>> while i < 3: ... i = i + 1 ... print i ... 1 2 3 >>>
  • 357. Loop >>> i = 0 >>> while i < 3: ... i = i + 1 ... print i ... 1 2 3 >>> no do-while statement in Python
  • 358. Traversal Sequence >>>
  • 359. Traversal Sequence >>> x = [1, 2, 3, 4, 5]
  • 360. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>>
  • 361. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>> for i in x:
  • 362. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>> for i in x: ...
  • 363. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>> for i in x: ... print i
  • 364. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>> for i in x: ... print i ...
  • 365. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>> for i in x: ... print i ... 1 2 3 4 5 >>>
  • 366. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>> for i in x: ... print i ... 1 2 3 4 5 >>>
  • 367. Traversal Sequence >>> x = [1, 2, 3, 4, 5] >>> for i in x: ... print i ... 1 2 3 4 5 >>> must be a iterable object
  • 368. Addition for Loop skip remaining statement and continue continue loop >>>
  • 369. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5):
  • 370. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5): ...
  • 371. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5): ... if i == 2:
  • 372. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5): ... if i == 2: ...
  • 373. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5): ... if i == 2: ... continue
  • 374. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5): ... if i == 2: ... continue ...
  • 375. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5): ... if i == 2: ... continue ... print i
  • 376. Addition for Loop skip remaining statement and continue continue loop >>> for i in range(5): ... if i == 2: ... continue ... print i ...
  • 377. Addition for Loop skip remaining statement and continue continue loop ... >>> for ifin range(5): i i == 2: ... if icontinue == 2: ... print i continue ... print i 0 ... 1 3 4 >>>
  • 378. Addition for Loop break >>> exit from loop
  • 379. Addition for Loop break exit from loop >>> for i in range(5):
  • 380. Addition for Loop break exit from loop >>> for i in range(5): ...
  • 381. Addition for Loop break exit from loop >>> for i in range(5): ... if i == 2:
  • 382. Addition for Loop break exit from loop >>> for i in range(5): ... if i == 2: ...
  • 383. Addition for Loop break exit from loop >>> for i in range(5): ... if i == 2: ... break
  • 384. Addition for Loop break exit from loop >>> for i in range(5): ... if i == 2: ... break ...
  • 385. Addition for Loop break exit from loop >>> for i in range(5): ... if i == 2: ... break ... print i
  • 386. Addition for Loop break exit from loop >>> for i in range(5): ... if i == 2: ... break ... print i ...
  • 387. Addition for Loop break exit from loop >>> for i in range(5): ... if i == 2: ... break ... print i ... 0 1 >>>
  • 388. Addition for Loop else >>> do something after unbroken loop
  • 389. Addition for Loop else do something after unbroken loop >>> for i in range(3):
  • 390. Addition for Loop else do something after unbroken loop >>> for i in range(3): ...
  • 391. Addition for Loop else do something after unbroken loop >>> for i in range(3): ... print i
  • 392. Addition for Loop else do something after unbroken loop >>> for i in range(3): ... print i ...
  • 393. Addition for Loop else do something after unbroken loop >>> for i in range(3): ... print i ... else:
  • 394. Addition for Loop else do something after unbroken loop >>> for i in range(3): ... print i ... else: ...
  • 395. Addition for Loop else do something after unbroken loop >>> for i in range(3): ... print i ... else: ... print “done”
  • 396. Addition for Loop else do something after unbroken loop >>> for i in range(3): ... print i ... else: ... print “done” ...
  • 397. Addition for Loop else do something after unbroken loop ... >>> for i in range(3): print i ... else: print i ... else: print “done” ... print “done” 0 ... 1 2 done >>>
  • 398. Standard I/O
  • 399. Evaluated Input input >>> read a string can be evaluated return an evaluated object
  • 400. Evaluated Input input >>> input() read a string can be evaluated return an evaluated object
  • 401. Evaluated Input input >>> input() 1 read a string can be evaluated return an evaluated object
  • 402. Evaluated Input input >>> input() 1 1 >>> read a string can be evaluated return an evaluated object
  • 403. Evaluated Input input >>> input() 1 1 >>> input() read a string can be evaluated return an evaluated object
  • 404. Evaluated Input input >>> input() 1 1 >>> input() 1 + 2 read a string can be evaluated return an evaluated object
  • 405. Evaluated Input input >>> input() 1 1 >>> input() 1 + 2 3 >>> read a string can be evaluated return an evaluated object
  • 406. Evaluated Input read a string can be evaluated return an evaluated object input >>> 1 1 >>> 1 + 3 >>> input() input() 2 input()
  • 407. Evaluated Input read a string can be evaluated return an evaluated object input >>> 1 1 >>> 1 + 3 >>> 5.0 input() input() 2 input() / 2
  • 408. Evaluated Input read a string can be evaluated return an evaluated object input 1 >>> 1 >>> 1 1 + >>> 3 1 + >>> 3 5.0 >>> 2.5 5.0 >>> input() input() 2 input() 2 input() / 2 input() / 2
  • 409. Evaluated Input read a string can be evaluated return an evaluated object input 1 >>> >>> 1 >>> 1 + 3 1 + >>> >>> 3 1 + 5.0 >>> 3 2.5 5.0 >>> >>> 2.5 5.0 >>> input() input() 2 input() 2 input() input() 2 / 2 input() / 2 input() input() / 2 input()
  • 410. Evaluated Input input 1 >>> input() >>> input() 1 >>> 2 1 + input() 3 1 + 2 >>> input() >>> input() 3 1 + 2 5.0 / 2 >>> input() 3 2.5 5.0 / 2 >>> input() >>> 2.5 input() 5.0 / 2 “aaa bbb” >>> input() read a string can be evaluated return an evaluated object
  • 411. Evaluated Input input 1 + 2 >>> input() 3 >>> input() 1 >>> 2 1 + input() 5.0 / 3 1 + 2 2 >>> input() 2.5 >>> input() 3 1 + 2 5.0 / 2 >>> input() 3 “aaa 2 2.5 5.0 /bbb” >>> input() ‘aaa 2 >>> 2.5 input() 5.0 /bbb’ “aaa bbb” >>> input() read a string can be evaluated return an evaluated object
  • 412. Evaluated Input input 1 + 2 >>> input() 3 >>> input() 1 >>> 2 1 + input() 5.0 / 3 1 + 2 2 >>> input() 2.5 >>> input() 3 1 + 2 5.0 / 2 >>> input() 3 “aaa 2 2.5 5.0 /bbb” >>> input() ‘aaa 2 >>> 2.5 input() 5.0 /bbb’ “aaa bbb” >>> input() read a string can be evaluated return an evaluated object
  • 413. Evaluated Input input 3 1 + 2 >>> input() 3 >>> input() 1 5.0 / >>> 2 2 1 + input() 2.5 5.0 / 3 1 + 2 2 >>> input() 2.5 >>> input() 3 1 + 2 “aaa 2 5.0 /bbb” >>> input() 3 ‘aaa “aaa 2 2.5 bbb’ 5.0 /bbb” >>> input() ‘aaa 2 >>> 2.5 input() 5.0 /bbb’ [1, bbb” “aaa2, 3] >>> input() read a string can be evaluated return an evaluated object
  • 414. Evaluated Input input 5.0 / 3 1 + 2 2 >>> input() 2.5 3 >>> input() 1 5.0 / >>> 2 2 1 + input() “aaa 2.5 5.0 / 2 3 1 + 2bbb” >>> input() ‘aaa 2.5 >>> input() 3 1 + 2bbb’ “aaa 2 5.0 /bbb” >>> input() 3 [1, ‘aaa “aaa bbb’ 2.5 2,23] 5.0 /bbb” >>> input() [1, ‘aaa >>> 2,23] 2.5 input() 5.0 /bbb’ [1, bbb” “aaa2, 3] >>> input() read a string can be evaluated return an evaluated object
  • 415. Evaluated Input input 5.0 / 3 1 + 2 2 >>> input() 2.5 3 >>> input() 1 5.0 / >>> 2 2 1 + input() “aaa 2.5 5.0 / 2 3 1 + 2bbb” >>> input() ‘aaa 2.5 >>> input() 3 1 + 2bbb’ “aaa 2 5.0 /bbb” >>> input() 3 [1, ‘aaa “aaa bbb’ 2.5 2,23] 5.0 /bbb” >>> input() [1, ‘aaa >>> 2,23] 2.5 input() 5.0 /bbb’ [1, bbb” “aaa2, 3] >>> input() read a string can be evaluated return an evaluated object
  • 416. Evaluated Input input 2.5 5.0 / 3 1 + 2 2 >>> input() 2.5 3 >>> input() 1 “aaa 5.0 / 2 >>> 2bbb” 1 + input() ‘aaa “aaa 2 2.5 5.0 /bbb’ 3 1 + 2bbb” >>> input() ‘aaa 2.5 >>> input() 3 1 + 2bbb’ [1, “aaa2,23] 5.0 /bbb” >>> input() 3 [1, ‘aaa “aaa bbb’ 2.5 2,23] 5.0 /bbb” >>> input() [1, ‘aaa >>> 2,23] 2.5 input() 5.0 /bbb’ 1 2 [1, bbb” “aaa2, 3] >>> input() read a string can be evaluated return an evaluated object
  • 417. Evaluated Input input read a string can be evaluated return an evaluated object 2.5 5.0 / 3 1 + 2 2 >>> input() 2.5 3 >>> 1 2 input() Traceback “aaa 5.0 / 2 >>> 2bbb” (most recent call last): 1 + input() ‘aaa “aaa 2.5 5.0 /bbb’ 3 File2"<input>", line 1, in <module> 1 + 2bbb” >>> input() ‘aaa 2.5 >>> input() 3 File "<string>", line 1 1 + 2bbb’ [1, 1 “aaa2,23] 5.0 /bbb” >>> input() 3 [1, ‘aaa ^ “aaa bbb’ 2.5 2,23] 5.0 /bbb” >>> input() SyntaxError: [1, ‘aaa >>> 2,23] 2.5 input() unexpected EOF while parsing 5.0 /bbb’ 1 2 [1, bbb” “aaa2, 3] >>> input()
  • 418. Raw Input read a string raw_input() return a string >>>
  • 419. Raw Input read a string raw_input() return a string >>> raw_input()
  • 420. Raw Input read a string raw_input() return a string >>> raw_input() 1
  • 421. Raw Input read a string raw_input() return a string >>> raw_input() 1 ‘1’ >>>
  • 422. Raw Input read a string raw_input() return a string >>> raw_input() 1 ‘1’ >>> raw_input()
  • 423. Raw Input read a string raw_input() return a string >>> raw_input() 1 ‘1’ >>> raw_input() 1 + 2
  • 424. Raw Input read a string raw_input() return a string >>> raw_input() 1 ‘1’ >>> raw_input() 1 + 2 ‘1 + 2’ >>>
  • 425. Raw Input read a string raw_input() return a string >>> raw_input() 1 ‘1’ >>> raw_input() 1 + 2 ‘1 + 2’ >>> raw_input()
  • 426. Raw Input read a string raw_input() return a string >>> raw_input() 1 ‘1’ >>> raw_input() 1 + 2 ‘1 + 2’ >>> raw_input() 5.0 / 2
  • 427. Raw Input read a string raw_input() return a string 1 >>> raw_input() ‘1’ 1 >>> ‘1’ raw_input() 1 + 2 >>> raw_input() ‘1 1 ++22’ >>> 2’ ‘1 +raw_input() 5.0 / 2 >>> raw_input() ‘5.0 5.0 //22’ >>>
  • 428. Raw Input read a string raw_input() return a string ‘1’ 1 >>> raw_input() >>> ‘1’ raw_input() 1 1 + >>> 2 ‘1’ raw_input() ‘1 1 + 22’ >>>+raw_input() >>> ‘1 raw_input() 1 ++22’ 5.0 >>> /2’ ‘1 +raw_input() 2 ‘5.0 5.0 //22’ >>> raw_input() >>> ‘5.0raw_input() 5.0 //22’ >>> raw_input()
  • 429. Raw Input read a string raw_input() return a string ‘1’ 1 >>> raw_input() >>> ‘1’ raw_input() 1 1 + >>> 2 ‘1’ raw_input() ‘1 1 + 22’ >>>+raw_input() >>> ‘1 raw_input() 1 ++22’ 5.0 >>> /2’ ‘1 +raw_input() 2 ‘5.0 5.0 //22’ >>> raw_input() >>> ‘5.0raw_input() 5.0 //22’ “aaa bbb” >>> raw_input()
  • 430. Raw Input read a string raw_input() return a string ‘1’ 1 + 2 >>> raw_input() ‘1 >>> ‘1’ 2’ 1 +raw_input() 1 + >>> 2 ‘1’ raw_input() 5.0 ‘1 / 2 1 + 22’ >>>+raw_input() ‘5.0 >>> / ‘1 raw_input() 1 ++22’2’ 5.0 >>> /2’ ‘1 +raw_input() 2 “aaa ‘5.0 bbb” 5.0 //22’ >>> raw_input() ‘“aaa bbb”’ >>> ‘5.0raw_input() 5.0 //22’ “aaa bbb” >>> raw_input()
  • 431. Raw Input read a string raw_input() return a string ‘1’ 1 + 2 >>> raw_input() ‘1 >>> ‘1’ 2’ 1 +raw_input() 1 + >>> 2 ‘1’ raw_input() 5.0 ‘1 / 2 1 + 22’ >>>+raw_input() ‘5.0 >>> / ‘1 raw_input() 1 ++22’2’ 5.0 >>> /2’ ‘1 +raw_input() 2 “aaa ‘5.0 bbb” 5.0 //22’ >>> raw_input() ‘“aaa bbb”’ >>> ‘5.0raw_input() 5.0 //22’ “aaa bbb” >>> raw_input()
  • 432. Raw Input read a string raw_input() return a string ‘1 ‘1’ 1 + 22’ >>>+raw_input() ‘1 >>> ‘1’ 2’ 1 +raw_input() 5.0 1 + / >>> 2 2 ‘1’ raw_input() ‘5.0 5.0 ‘1 //2 1 + 22’2’ >>>+raw_input() ‘5.0 >>> / ‘1 raw_input() 1 ++22’2’ “aaa 2 5.0 bbb” >>> /2’ ‘1 +raw_input() ‘“aaa “aaa bbb”’ ‘5.0 bbb” 5.0 //22’ >>> raw_input() ‘“aaa bbb”’ >>> ‘5.0raw_input() 5.0 //22’ [1, bbb” “aaa2, 3] >>> raw_input()
  • 433. Raw Input read a string raw_input() return a string 5.0 ‘1 ‘1’ / 2 1 + 22’ >>>+raw_input() ‘5.0 ‘1 >>> / ‘1’ 2’2’ 1 +raw_input() 5.0 1 + / >>> 2 2 ‘1’ raw_input() “aaa ‘5.0 5.0 bbb” ‘1 //2 1 + 22’2’ >>>+raw_input() ‘“aaa ‘5.0 >>> /bbb”’ ‘1 raw_input() 1 ++22’2’ “aaa 2 5.0 bbb” >>> /2’ ‘1 +raw_input() [1, ‘“aaa 3] “aaa bbb” ‘5.02,bbb”’ 5.0 //22’ >>> raw_input() ‘[1, ‘“aaa bbb”’ >>> 2, 3]’ ‘5.0raw_input() 5.0 //22’ [1, bbb” “aaa2, 3] >>> raw_input()
  • 434. Raw Input read a string raw_input() return a string 5.0 ‘1 ‘1’ / 2 1 + 22’ >>>+raw_input() ‘5.0 ‘1 >>> / ‘1’ 2’2’ 1 +raw_input() 5.0 1 + / >>> 2 2 ‘1’ raw_input() “aaa ‘5.0 5.0 bbb” ‘1 //2 1 + 22’2’ >>>+raw_input() ‘“aaa ‘5.0 >>> /bbb”’ ‘1 raw_input() 1 ++22’2’ “aaa 2 5.0 bbb” >>> /2’ ‘1 +raw_input() [1, ‘“aaa 3] “aaa bbb” ‘5.02,bbb”’ 5.0 //22’ >>> raw_input() ‘[1, ‘“aaa bbb”’ >>> 2, 3]’ ‘5.0raw_input() 5.0 //22’ [1, bbb” “aaa2, 3] >>> raw_input()
  • 435. Raw Input read a string raw_input() return a string ‘5.0 5.0 ‘1 ‘1’ //2 1 + 22’2’ >>>+raw_input() ‘5.0 ‘1 >>> / ‘1’ 2’2’ 1 +raw_input() “aaa 5.0 1 + / 2 >>> 2bbb” ‘1’ raw_input() ‘“aaa “aaa ‘5.0 bbb”’ 5.0 bbb” ‘1 //2 1 + 22’2’ >>>+raw_input() ‘“aaa ‘5.0 >>> /bbb”’ ‘1 raw_input() 1 ++22’2’ [1, “aaa bbb” 5.0 2,2 >>> /2’3] ‘1 +raw_input() ‘[1, [1, ‘“aaa2,3] “aaa bbb” ‘5.02,bbb”’ 5.0 //22’ >>> raw_input() 3]’ ‘[1, ‘“aaa bbb”’ >>> 2, 3]’ ‘5.0raw_input() 5.0 //22’ 1 2 [1, bbb” “aaa2, 3] >>> raw_input()
  • 436. Raw Input read a string raw_input() return a string “aaa ‘5.0 5.0 bbb” ‘1 ‘1’ //2 1 + 22’2’ >>>+raw_input() ‘“aaa ‘5.0 ‘1 >>> /bbb”’ ‘1’ 2’2’ 1 +raw_input() “aaa 5.0 1 + / 2 >>> 2bbb” ‘1’ raw_input() [1, ‘“aaa “aaa ‘5.0 bbb” 5.0 2,bbb”’ ‘1 //23] 1 + 22’2’ >>>+raw_input() ‘[1, ‘“aaa ‘5.0 2, 3]’ >>> /bbb”’ ‘1 raw_input() 1 ++22’2’ [1, “aaa bbb” 5.0 2,2 >>> /2’3] ‘1 +raw_input() 1 2 ‘[1, [1, ‘“aaa2,3] “aaa bbb” ‘5.02,bbb”’ 5.0 //22’ >>> raw_input() 3]’ ‘1 ‘[1, ‘“aaa bbb”’ >>> raw_input() ‘5.0/2, 3]’ 5.02’/22’ 1 2 [1, bbb” “aaa2, 3] >>> raw_input()
  • 437. Output print >>> print object to standard output
  • 438. Output print print object to standard output >>> print “Hello World!”
  • 439. Output print print object to standard output >>> print “Hello World!” Hello World! >>>
  • 440. Output print print object to standard output >>> print “Hello World!” Hello World! >>> print “Hello”, “World!”
  • 441. Output print print object to standard output >>> print “Hello World!” Hello World! >>> print “Hello”, “World!” Hello World! >>>
  • 442. Output print print object to standard output >>> print “Hello World!” Hello World! >>> print “Hello”, “World!” Hello World! >>> print 1 + 2
  • 443. Output print print object to standard output >>> print “Hello World!” Hello World! >>> print “Hello”, “World!” Hello World! >>> print 1 + 2 3 >>>
  • 444. Output print print object to standard output >>> print “Hello World!” Hello World! >>> print “Hello”, “World!” Hello World! >>> print 1 + 2 3 >>> print [1, 2, 3]
  • 445. Output print print object to standard output >>> print “Hello World!” Hello World! >>> print “Hello”, “World!” Hello World! >>> print 1 + 2 3 >>> print [1, 2, 3] [1, 2, 3] >>>
  • 446. Custom Function
  • 447. Define a Function >>>
  • 448. Define a Function >>> def SQ(x):
  • 449. Define a Function >>> def SQ(x): ...
  • 450. Define a Function >>> def SQ(x): ... return x * x
  • 451. Define a Function >>> def SQ(x): ... return x * x ...
  • 452. Define a Function >>> def SQ(x): ... return x * x ... >>>
  • 453. Define a Function >>> def SQ(x): ... return x * x ... >>> SQ(10)
  • 454. Define a Function >>> def SQ(x): ... return x * x ... >>> SQ(10) 100 >>>
  • 455. Define a Function >>> def SQ(x): ... return x * x ... >>> SQ(10) 100 >>>
  • 456. Define a Function >>> def SQ(x): ... return x * x ... >>> SQ(10) 100 >>> function name
  • 457. Define a Function >>> def SQ(x): ... return x * x ... >>> SQ(10) 100 >>> function name parameter
  • 458. Define a Function >>> def SQ(x): ... return x * x ... >>> SQ(10) 100 >>> function name parameter function content
  • 459. Lambda Function >>>
  • 460. Lambda Function >>> CUBE = lambda k: k * k * k
  • 461. Lambda Function >>> CUBE = lambda k: k * k * k >>>
  • 462. Lambda Function >>> CUBE = lambda k: k * k * k >>> CUBE(10)
  • 463. Lambda Function >>> CUBE = lambda k: k * k * k >>> CUBE(10) 1000 >>>
  • 464. Lambda Function >>> CUBE = lambda k: k * k * k >>> CUBE(10) 1000 >>> (lambda x, y: x * y)(3, 4)
  • 465. Lambda Function >>> CUBE = lambda k: k * k * k >>> CUBE(10) 1000 >>> (lambda x, y: x * y)(3, 4) 12 >>>
  • 466. Lambda Function >>> CUBE = lambda k: k * k * k >>> CUBE(10) 1000 >>> (lambda x, y: x * y)(3, 4) 12 >>>
  • 467. Lambda Function >>> CUBE = lambda k: k * k * k >>> CUBE(10) 1000 >>> (lambda x, y: x * y)(3, 4) 12 >>> parameter
  • 468. Lambda Function >>> CUBE = lambda k: k * k * k >>> CUBE(10) 1000 >>> (lambda x, y: x * y)(3, 4) 12 >>> return value parameter
  • 469. Built-in Function
  • 470. range >>>
  • 471. range >>> range(10)
  • 472. range >>> range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>>
  • 473. range >>> range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range(3, 10)
  • 474. range >>> [0, >>> [3, >>> range(10) 1, 2, 3, 4, 5, 6, 7, 8, 9] range(3, 10) 4, 5, 6, 7, 8, 9]
  • 475. range >>> [0, >>> [3, >>> range(10) 1, 2, 3, 4, 5, 6, 7, 8, 9] range(3, 10) 4, 5, 6, 7, 8, 9] range(1, 10, 2)
  • 476. range >>> [0, >>> [3, >>> [1, >>> range(10) 1, 2, 3, 4, 5, 6, 7, 8, 9] range(3, 10) 4, 5, 6, 7, 8, 9] range(1, 10, 2) 3, 5, 7, 9]
  • 477. range >>> [0, >>> [3, >>> [1, >>> range(10) 1, 2, 3, 4, 5, 6, 7, 8, 9] range(3, 10) 4, 5, 6, 7, 8, 9] range(1, 10, 2) 3, 5, 7, 9] range(10, 0, -1)
  • 478. range >>> range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range(3, 10) [3, 4, 5, 6, 7, 8, 9] >>> range(1, 10, 2) [1, 3, 5, 7, 9] >>> range(10, 0, -1) [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>>
  • 479. range >>> range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range(3, 10) [3, 4, 5, 6, 7, 8, 9] >>> range(1, 10, 2) [1, 3, 5, 7, 9] >>> range(10, 0, -1) [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>>
  • 480. range >>> range(10) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range(3, 10) [3, 4, 5, 6, 7, 8, 9] >>> range(1, 10, 2) [1, 3, 5, 7, 9] >>> range(10, 0, -1) [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>> range(stop)
  • 481. range >>> range(10) range(stop) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range(3, 10) range(start, stop) [3, 4, 5, 6, 7, 8, 9] >>> range(1, 10, 2) [1, 3, 5, 7, 9] >>> range(10, 0, -1) [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>>
  • 482. range >>> range(10) range(stop) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] >>> range(3, 10) range(start, stop) [3, 4, 5, 6, 7, 8, 9] >>> range(1, 10, 2) range(start, stop, step) [1, 3, 5, 7, 9] >>> range(10, 0, -1) [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] >>>
  • 483. filter >>>
  • 484. filter >>> x = range(1, 11)
  • 485. filter >>> x = range(1, 11) >>>
  • 486. filter >>> x = range(1, 11) >>> filter(lambda k: k % 2 == 0, x)
  • 487. filter >>> x = range(1, 11) >>> filter(lambda k: k % 2 == 0, x) [2, 4, 6, 8, 10] >>>
  • 488. filter >>> x = range(1, 11) >>> filter(lambda k: k % 2 == 0, x) [2, 4, 6, 8, 10] >>>
  • 489. filter >>> x = range(1, 11) >>> filter(lambda k: k % 2 == 0, x) [2, 4, 6, 8, 10] >>> a function receive one parameter and return boolean value
  • 490. filter >>> x = range(1, 11) >>> filter(lambda k: k % 2 == 0, x) [2, 4, 6, 8, 10] >>> a function receive one parameter and return boolean value iterable object
  • 491. map >>>
  • 492. map >>> x = range(1, 6)
  • 493. map >>> x = range(1, 6) >>>
  • 494. map >>> x = range(1, 6) >>> map(lambda k: k * k, x)
  • 495. map >>> x = range(1, 6) >>> map(lambda k: k * k, x) [1, 4, 9, 16, 25] >>>
  • 496. map >>> x = range(1, 6) >>> map(lambda k: k * k, x) [1, 4, 9, 16, 25] >>>
  • 497. map >>> x = range(1, 6) >>> map(lambda k: k * k, x) [1, 4, 9, 16, 25] >>> any function receive one parameter
  • 498. map >>> x = range(1, 6) >>> map(lambda k: k * k, x) [1, 4, 9, 16, 25] >>> any function receive one parameter iterable object
  • 499. reduce >>>
  • 500. reduce >>> x = range(1, 6)
  • 501. reduce >>> x = range(1, 6) >>>
  • 502. reduce >>> x = range(1, 6) >>> reduce(lambda a, b: a**2 + b, x)
  • 503. reduce >>> x = range(1, 6) >>> reduce(lambda a, b: a**2 + b, x) 21909 >>>
  • 504. reduce >>> x = range(1, 6) >>> reduce(lambda a, b: a**2 + b, x) 21909 >>>
  • 505. reduce >>> x = range(1, 6) >>> reduce(lambda a, b: a**2 + b, x) 21909 >>> any function receive two parameters
  • 506. reduce >>> x = range(1, 6) >>> reduce(lambda a, b: a**2 + b, x) 21909 >>> any function receive two parameters iterable object
  • 507. reduce >>> x = range(1, 6) >>> reduce(lambda a, b: a**2 + b, x) 21909 >>> any function receive two calculate ((((1^2)+2)^2+3)^2+4)^2+5 parameters iterable object
  • 508. factorial >>>
  • 509. factorial >>> reduce(lambda a, b: a * b, range(1, 6))
  • 510. factorial >>> reduce(lambda a, b: a * b, range(1, 6)) 120 >>>
  • 511. Comprehension
  • 512. List Comprehension >>>
  • 513. List Comprehension >>> [i**2 for i in range(1, 6)]
  • 514. List Comprehension >>> [i**2 for i in range(1, 6)] [1, 4, 9, 16, 25] >>>
  • 515. List Comprehension >>> [i**2 for i in range(1, 6)] [1, 4, 9, 16, 25] >>> [str(i) for i in range(5)]
  • 516. List Comprehension >>> [i**2 for i in range(1, 6)] [1, 4, 9, 16, 25] >>> [str(i) for i in range(5)] ['0', '1', '2', '3', '4'] >>>
  • 517. List Comprehension >>> [i**2 for i in range(1, 6)] [1, 4, 9, 16, 25] >>> [str(i) for i in range(5)] ['0', '1', '2', '3', '4'] >>>
  • 518. List Comprehension >>> [i**2 for i in range(1, 6)] [1, 4, 9, 16, 25] >>> [str(i) for i in range(5)] ['0', '1', '2', '3', '4'] >>> processing & return value
  • 519. List Comprehension >>> [i**2 for i in range(1, 6)] [1, 4, 9, 16, 25] >>> [str(i) for i in range(5)] ['0', '1', '2', '3', '4'] >>> processing & return value iterable object
  • 520. Dict Comprehension >>>
  • 521. Dict Comprehension >>> {i: i**2 for i in range(1, 6)}
  • 522. Dict Comprehension >>> {i: i**2 for i in range(1, 6)} {1: 1, 2: 4, 3: 9, 4: 16, 5: 25} >>>
  • 523. Dict Comprehension >>> {i: i**2 for i in range(1, 6)} {1: 1, 2: 4, 3: 9, 4: 16, 5: 25} >>> {i: str(i) for i in range(5)}
  • 524. Dict Comprehension >>> {1: >>> {0: >>> {i: i**2 for i in range(1, 6)} 1, 2: 4, 3: 9, 4: 16, 5: 25} {i: str(i) for i in range(5)} '0', 1: '1', 2: '2', 3: '3', 4: '4'}
  • 525. Dict Comprehension >>> {1: >>> {0: >>> {i: i**2 for i in range(1, 6)} 1, 2: 4, 3: 9, 4: 16, 5: 25} {i: str(i) for i in range(5)} '0', 1: '1', 2: '2', 3: '3', 4: '4'}
  • 526. Dict Comprehension >>> {1: >>> {0: >>> {i: i**2 for i in range(1, 6)} 1, 2: 4, 3: 9, 4: 16, 5: 25} {i: str(i) for i in range(5)} '0', 1: '1', 2: '2', 3: '3', 4: '4'} processing & return value
  • 527. Dict Comprehension >>> {1: >>> {0: >>> {i: i**2 for i in range(1, 6)} 1, 2: 4, 3: 9, 4: 16, 5: 25} {i: str(i) for i in range(5)} '0', 1: '1', 2: '2', 3: '3', 4: '4'} processing & return value iterable object
  • 528. Generator Comprehension >>>
  • 529. Generator Comprehension >>> (i**2 for i in range(1, 6))
  • 530. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>>
  • 531. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>> (str(i) for i in range(5))
  • 532. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>> (str(i) for i in range(5)) <generator object <genexpr> at 0x1104946e0> >>>
  • 533. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>> (str(i) for i in range(5)) <generator object <genexpr> at 0x1104946e0> >>>
  • 534. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>> (str(i) for i in range(5)) <generator object <genexpr> at 0x1104946e0> >>> processing & return value
  • 535. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>> (str(i) for i in range(5)) <generator object <genexpr> at 0x1104946e0> >>> processing & return value iterable object
  • 536. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>> (str(i) for i in range(5)) <generator object <genexpr> at 0x1104946e0> >>> it contains the rule in processing & return value the object iterable object
  • 537. Generator Comprehension >>> (i**2 for i in range(1, 6)) <generator object <genexpr> at 0x110494690> >>> (str(i) for i in range(5)) <generator object <genexpr> at 0x1104946e0> >>> it contains the rule in save the memory processing & return value the object iterable object
  • 538. Use a Generator >>>
  • 539. Use a Generator >>> x = (i**2 for i in range(5))
  • 540. Use a Generator >>> x = (i**2 for i in range(5)) >>>
  • 541. Use a Generator >>> x = (i**2 for i in range(5)) >>> x
  • 542. Use a Generator >>> x = (i**2 for i in range(5)) >>> x <generator object <genexpr> at 0x110494690> >>>
  • 543. Use a Generator >>> x = (i**2 for i in range(5)) >>> x <generator object <genexpr> at 0x110494690> >>> for i in x:
  • 544. Use a Generator >>> x = (i**2 for i in range(5)) >>> x <generator object <genexpr> at 0x110494690> >>> for i in x: ...
  • 545. Use a Generator >>> x = (i**2 for i in range(5)) >>> x <generator object <genexpr> at 0x110494690> >>> for i in x: ... print i
  • 546. Use a Generator >>> x = (i**2 for i in range(5)) >>> x <generator object <genexpr> at 0x110494690> >>> for i in x: ... print i ...
  • 547. Use a Generator >>> x = (i**2 for i in range(5)) >>> x <generator object <genexpr> at 0x110494690> >>> for i in x: ... print i ... 0 1 4 9 16 >>>
  • 548. Help Yourself
  • 549. Help >>>
  • 550. Help >>> help(reduce)
  • 551. Help Help on built-in >>> help(reduce) function reduce in module __builtin__: reduce(...) reduce(function, sequence[, initial]) > value Apply a function of two arguments cumulatively to the items of a sequence, from left to right, so as to reduce the sequence to a single value. For example, reduce(lambda x, y: x+y,
  • 552. Help __builtin__: Help on built-in >>> help(reduce) function reduce in module __builtin__: reduce(...) reduce(...) reduce(function, sequence[, initial]) > value reduce(function, sequence[, initial]) > value Apply a function of two arguments cumulativelyfunctionitems ofarguments Apply a to the of two a sequence, cumulatively to the items of ato reduce the from left to right, so as sequence, sequence left to right, so as to reduce the from to a single value. sequenceexample, reduce(lambda x, y: x+y, For to a single value. [1, For3, 4, 5]) reduce(lambda x, y: x+y, 2, example, calculates
  • 553. Help __builtin__: Help on built-in >>> help(reduce) function reduce in module reduce(...) __builtin__: reduce(...) reduce(function, sequence[, initial]) > value reduce(...) reduce(function, sequence[, initial]) > value reduce(function, sequence[, initial]) > value Apply a function of two arguments cumulativelyfunctionitems ofarguments Apply a to the of two a sequence, cumulativelyfunctionitems ofarguments from a Applyleftto the of twoasato reduce the to right, so sequence, sequence left to right, so as sequence, cumulativelyato the items of ato reduce the from to single value. sequenceexample, right, so as to reduce the For to a single value. from left to reduce(lambda x, y: x+y, [1, For3,to a5]) calculates sequenceexample, reduce(lambda x, y: x+y, 2, 4, single value. [1, For3, 4, 5]) reduce(lambda x, y: x+y, ((((1+2)+3)+4)+5). If 2, example, calculatesinitial is
  • 554. Help reduce(...) __builtin__: Help on built-in >>> help(reduce) function reduce in module reduce(...) __builtin__: reduce(function, sequence[, initial]) > value reduce(...) reduce(function, sequence[, initial]) > value reduce(...) reduce(function, sequence[, initial]) > value Apply a function of two arguments reduce(function, sequence[, initial]) cumulativelyfunctionitems ofarguments > value Apply a to the of two a sequence, cumulativelyfunctionitems ofarguments from a Applyleftto the of twoasato reduce the to right, so sequence, sequence leftto the of twoasato reduce the cumulativelyfunctionitems ofarguments from a Applyto a to right, so single value. sequence, sequenceexample, right, so as sequence, cumulativelyato the items of ato reduce the For to from left to reduce(lambda x, y: x+y, single value. [1, from left5]) reduce(lambda x, y: x+y, sequenceexample, right, so as to reduce the 2, For3,to a to calculates 4, single value. [1, For3,to a5]) calculatesinitial is sequenceexample, reduce(lambda x, y: x+y, ((((1+2)+3)+4)+5). If 2, 4, single value. present,example, reduce(lambda x, y: x+y, [1, For3,it is placed before the items ((((1+2)+3)+4)+5). If initial is 2, 4, 5]) calculates
  • 555. Help reduce(...) __builtin__: Helpreduce(function, sequence[, in module >>> help(reduce) function reduceinitial]) on built-in > value reduce(...) __builtin__: reduce(function, sequence[, initial]) > value reduce(...) reduce(function, sequence[, initial]) > value reduce(...) function sequence[, initial]) Apply a reduce(function, of two arguments cumulativelyfunctionitems ofarguments > value Apply a to the of two a initial]) reduce(function, sequence[,sequence, cumulativelyfunction of twoasato reduce the > value leftto the items ofarguments from Apply a to right, so sequence, sequence leftto the of twoasato reduce the cumulativelyfunctionitems ofarguments from a Applyto a to right, so single value. sequence, sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, For from to a to reduce(lambda sequence, Applyleftto right, so a single value. x, y: [1, from left5]) reduce(lambda x, y: x+y, sequenceexample, right, so as sequence, cumulativelyato the items of ato reduce the 2, For3,to 4, to calculates single value. [1, from left5]) reduce(lambda x, y: x+y, sequenceexample, right, so as to reduce the ((((1+2)+3)+4)+5). If 2, For3,to a to calculatesinitial is 4, single value. present, it issingle value. the [1, For3,to a5]) calculatesinitialy: x+y, sequenceexample, reduce(lambda x,items ((((1+2)+3)+4)+5).before 2, 4, placed If is present,example, reduce(lambda x, y: x+y, [1, For3,itsequence inbefore the items and of ((((1+2)+3)+4)+5). If calculation, 2, the4,is placed the initial is 5]) calculates
  • 556. Help > value built-in reduce(...) __builtin__: Helpreduce(function, sequence[, in module >>> help(reduce) function reduceinitial]) on > value reduce(...) __builtin__: reduce(function, sequence[, initial]) > value reduce(...) function sequence[, initial]) Apply a reduce(function, of two arguments cumulatively to the sequence[,sequence, > value reduce(...) functionitems ofarguments Apply a reduce(function, of two a initial]) cumulativelyfunction sequence[,sequence,the > value leftto the items ofarguments from Apply a reduce(function, of twoasatoinitial]) to right, so reduce sequence to a to right, so cumulativelyfunction of twoasato reduce the > value leftto the items ofarguments from Apply a single value. sequence, sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, For from to a to reduce(lambda sequence, Applyleftto right, so a single value. x, y: [1, Applyleftto right, so sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, 2, For3, a from to a5]) reduce(lambda sequence, 4, to calculates single value. x, y: [1, from left5]) reduce(lambda x, y: x+y, sequenceexample, right, so as sequence, cumulativelyato the items of ato reduce the ((((1+2)+3)+4)+5). If initial is 2, For3,to 4, to calculates single value. present, to a to calculatesinitialy: x+y, [1, from left5]) reduce(lambdato items sequenceexample, right, so asthe reduce the ((((1+2)+3)+4)+5).before 2, For3,it issingle value. 4, placed If x, is present, it a5]) calculatesinitial is [1, For3,tosequence inbefore the y: x+y, sequenceexample, reduce(lambda x,items and of ((((1+2)+3)+4)+5). the 2, the4,issingle value.calculation, placed If serves the4,is placed the initial is present,example, reduce(lambda x, y: x+y, [1, For3,itsequence inbefore the items and of ((((1+2)+3)+4)+5). 2, as a default whenIf calculation, 5]) calculates the
  • 557. Help > value built-in reduce(...) __builtin__: Helpreduce(function, sequence[, in module >>> help(reduce) function reduceinitial]) on > value reduce(...) __builtin__:function sequence[, initial]) Apply a reduce(function, of two arguments cumulatively to the sequence[,sequence, > value reduce(...) functionitems ofarguments Apply a reduce(function, of two a initial]) cumulatively to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so reduce sequence to a to right, twoasatoinitial]) cumulativelyfunction sequence[,sequence,the > value leftto the items ofarguments from Apply a reduce(function, of so single value. reduce sequence leftto right, so cumulativelyfunction of twoasato reduce the > value example,the items ofargumentsx+y, For from a Applyto a to reduce(lambda sequence, single value. x, y: [1, Applyleftto right, so sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, 2, For3, a from to a5]) reduce(lambda sequence, 4, to calculates single value. x, y: [1, Applyleftto right, so initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5). If 2, For3, a from to a5]) reduce(lambda sequence, 4, to calculates single value. x, is present, to isto reduce(lambda sequence, [1, from left5]) right, so initialy: x+y, sequenceexample,the items of the items cumulativelyatoplacedvalue.asato reduce the ((((1+2)+3)+4)+5).before 2, For3,it 4, single calculates If x, is present, tosequence inbefore [1, from left5]) reduce(lambdato items and sequenceexample, right,the asthe reduce the of ((((1+2)+3)+4)+5). so 2, the4,issingle value.calculation, For3,it a to calculatesinitialy: x+y, placed If x, is serves the4,issinglewhenIf calculation, present, it a5]) calculatesinitial is [1, For3,tosequence inbefore the y: x+y, sequenceexample, reduce(lambda x,items and of ((((1+2)+3)+4)+5). the 2, as a default value. placed the serves the4,is placed present,example,empty. the initialy: x+y, [1, For3,itsequence inbefore the items and sequence 5]) reduce(lambda x, is of ((((1+2)+3)+4)+5). 2, as a default whenIf calculation, is calculates the
  • 558. Help > value built-in reduce(...) __builtin__:function of two arguments Helpreduce(function, sequence[, in module >>> help(reduce) function reduceinitial]) Apply a on cumulatively > value reduce(...) to the sequence[,sequence, __builtin__:functionitems ofarguments Apply a reduce(function, of two a initial]) cumulatively to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so reduce sequence to cumulativelya to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so single value. reduce sequence leftto right, twoasatoinitial]) cumulativelyfunction sequence[,sequence,the > value example,the items ofargumentsx+y, For from a Applyto a to reduce(lambda x,reduce reduce(function, of so single value. y: [1, Applyto a5]) reduce(lambda sequence, sequenceexample, right, so cumulativelyfunction of twoasato reduce the > value3,leftto the items ofargumentsx+y, 2, For from a 4, to calculates single value. x, y: [1, Applyleftto right, so initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5). If 2, For3, a from to a5]) reduce(lambda sequence, 4, to calculates single value. x, is present, to a5]) right, so [1, Applylefttoplacedvalue.initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5).before the items 2, For3, a from it isto reduce(lambda sequence, 4, single calculates If x, is present, tosequence inbefore [1, from left5]) right,the initialy: x+y, sequenceexample,the items of the items and cumulativelyatoplacedvalue.asato reduce the of ((((1+2)+3)+4)+5). so calculation, 2, the4, single For3,it isto reduce(lambda sequence, calculates If x, is serves 3,it a to calculatesinitialy: x+y, present, tosequence inbefore [1, from left5]) reduce(lambdato items and sequenceexample, right,the asthe reduce the of ((((1+2)+3)+4)+5). If 2, as a default value. Forthe4,issinglewhenso calculation, placed the x, is serves the4,issinglewhenIf calculation, present, it a5]) reduce(lambda x, is [1, For3,tosequence in the initialy: x+y, sequenceexample,empty.before the items and sequence isplaced of ((((1+2)+3)+4)+5). 2, as a default value. calculates the (END) as a default whenIf calculation, serves the4,is placed present,example,empty. the initialy: x+y, [1, For3,itsequence inbefore the items and sequence 5]) reduce(lambda x, is of ((((1+2)+3)+4)+5). 2, is calculates the
  • 559. Help > value built-in reduce(...) __builtin__:function of two arguments Helpreduce(function, sequence[, in module >>> help(reduce) function reduceinitial]) Apply a on cumulatively > value reduce(...) to the sequence[,sequence, __builtin__:functionitems ofarguments Apply a reduce(function, of two a initial]) cumulatively to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so reduce sequence to cumulativelya to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so single value. reduce sequence leftto right, twoasatoinitial]) cumulativelyfunction sequence[,sequence,the > value example,the items ofargumentsx+y, For from a Applyto a to reduce(lambda x,reduce reduce(function, of so single value. y: [1, Applyto a5]) reduce(lambda sequence, sequenceexample, right, so cumulativelyfunction of twoasato reduce the > value3,leftto the items ofargumentsx+y, 2, For from a 4, to calculates single value. x, y: [1, Applyleftto right, so initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5). If 2, For3, a from to a5]) reduce(lambda sequence, 4, to calculates single value. x, is present, to a5]) right, so [1, Applylefttoplacedvalue.initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5).before the items 2, For3, a from it isto reduce(lambda sequence, 4, single calculates If x, is present, tosequence inbefore [1, from left5]) right,the initialy: x+y, sequenceexample,the items of the items and cumulativelyatoplacedvalue.asato reduce the of ((((1+2)+3)+4)+5). so calculation, 2, the4, single For3,it isto reduce(lambda sequence, calculates If x, is serves 3,it a to calculatesinitialy: x+y, present, tosequence inbefore [1, from left5]) reduce(lambdato items and sequenceexample, right,the asthe reduce the of ((((1+2)+3)+4)+5). If 2, as a default value. Forthe4,issinglewhenso calculation, placed the x, is serves the4,issinglewhenIf calculation, present, it a5]) reduce(lambda x, is [1, For3,tosequence in the initialy: x+y, sequenceexample,empty.before the items and sequence isplaced of ((((1+2)+3)+4)+5). 2, as a default value. calculates the (END) as a default whenIf calculation, serves the4,is placed present,example,empty. the initialy: x+y, [1, For3,itsequence inbefore the items and sequence 5]) reduce(lambda x, is of ((((1+2)+3)+4)+5). 2, is calculates the
  • 560. Help > value built-in reduce(...) __builtin__:function of two arguments Helpreduce(function, sequence[, in module >>> help(reduce) function reduceinitial]) Apply a on cumulatively > value reduce(...) to the sequence[,sequence, __builtin__:functionitems ofarguments Apply a reduce(function, of two a initial]) cumulatively to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so reduce sequence to cumulativelya to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so single value. reduce sequence leftto right, twoasatoinitial]) cumulativelyfunction sequence[,sequence,the > value example,the items ofargumentsx+y, For from a Applyto a to reduce(lambda x,reduce reduce(function, of so single value. y: [1, Applyto a5]) reduce(lambda sequence, sequenceexample, right, so cumulativelyfunction of twoasato reduce the > value3,leftto the items ofargumentsx+y, 2, For from a 4, to calculates single value. x, y: [1, Applyleftto right, so initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5). If 2, For3, a from to a5]) reduce(lambda sequence, 4, to calculates single value. x, is present, to a5]) right, so [1, Applylefttoplacedvalue.initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5).before the items 2, For3, a from it isto reduce(lambda sequence, 4, single calculates If x, is present, tosequence inbefore [1, from left5]) right,the initialy: x+y, sequenceexample,the items of the items and cumulativelyatoplacedvalue.asato reduce the of ((((1+2)+3)+4)+5). so calculation, 2, the4, single For3,it isto reduce(lambda sequence, calculates If x, is serves 3,it a to calculatesinitialy: x+y, present, tosequence inbefore [1, from left5]) reduce(lambdato items and sequenceexample, right,the asthe reduce the of ((((1+2)+3)+4)+5). If 2, as a default value. Forthe4,issinglewhenso calculation, placed the x, is serves the4,issinglewhenIf calculation, present, it a5]) reduce(lambda x, is [1, For3,tosequence in the initialy: x+y, sequenceexample,empty.before the items and sequence isplaced of ((((1+2)+3)+4)+5). 2, as a default value. calculates the (END) as a default whenIf calculation, serves the4,is placed present,example,empty. the initialy: x+y, [1, For3,itsequence inbefore the items and sequence 5]) reduce(lambda x, is of ((((1+2)+3)+4)+5). 2, is calculates the press q
  • 561. Help > value built-in reduce(...) __builtin__:function of two arguments Helpreduce(function, sequence[, in module >>> help(reduce) function reduceinitial]) Apply a on cumulatively > value reduce(...) to the sequence[,sequence, __builtin__:functionitems ofarguments Apply a reduce(function, of two a initial]) >>> reduce(function, of so cumulatively to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce sequence to cumulativelya to right, twoasatoinitial]) > value leftto the sequence[,sequence,the reduce(...) functionitems ofarguments from Apply a reduce(function, of so single value. reduce sequence leftto right, twoasatoinitial]) cumulativelyfunction sequence[,sequence,the > value example,the items ofargumentsx+y, For from a Applyto a to reduce(lambda x,reduce reduce(function, of so single value. y: [1, Applyto a5]) reduce(lambda sequence, sequenceexample, right, so cumulativelyfunction of twoasato reduce the > value3,leftto the items ofargumentsx+y, 2, For from a 4, to calculates single value. x, y: [1, Applyleftto right, so initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5). If 2, For3, a from to a5]) reduce(lambda sequence, 4, to calculates single value. x, is present, to a5]) right, so [1, Applylefttoplacedvalue.initialy: sequenceexample,the of twoasato reduce the cumulativelyfunctionitems ofargumentsx+y, ((((1+2)+3)+4)+5).before the items 2, For3, a from it isto reduce(lambda sequence, 4, single calculates If x, is present, tosequence inbefore [1, from left5]) right,the initialy: x+y, sequenceexample,the items of the items and cumulativelyatoplacedvalue.asato reduce the of ((((1+2)+3)+4)+5). so calculation, 2, the4, single For3,it isto reduce(lambda sequence, calculates If x, is serves 3,it a to calculatesinitialy: x+y, present, tosequence inbefore [1, from left5]) reduce(lambdato items and sequenceexample, right,the asthe reduce the of ((((1+2)+3)+4)+5). If 2, as a default value. Forthe4,issinglewhenso calculation, placed the x, is serves the4,issinglewhenIf calculation, present, it a5]) reduce(lambda x, is [1, For3,tosequence in the initialy: x+y, sequenceexample,empty.before the items and sequence isplaced of ((((1+2)+3)+4)+5). 2, as a default value. calculates the (END) as a default whenIf calculation, serves the4,is placed present,example,empty. the initialy: x+y, [1, For3,itsequence inbefore the items and sequence 5]) reduce(lambda x, is of ((((1+2)+3)+4)+5). 2, is calculates the press q
  • 562. pip
  • 563. pip Package manager for Python Download package in PyPI (Python Package Index)
  • 564. pip Package manager for Python Download package in PyPI (Python Package Index) https://pypi.python.org/pypi
  • 565. Python Package Index
  • 566. Python Package Index There are currently 31069 packages here.
  • 567. Install pip For Ubuntu $ apt-get install python-pip For OS X $ brew install python
  • 568. Install Pip on Windows Go to https://pypi.python.org/pypi/distribute/0.6.45. Download the source code, and unzip it. Go to the directory and execute the following command. > python.exe setup.py install Go to http://www.lfd.uci.edu/~gohlke/pythonlibs/#pip, and download pip installer.
  • 569. Basic Command Install Package $ pip install [package_name] Uninstall Package $ pip uninstall [package_name] Search Package $ pip search [package_name]
  • 570. All Command bundle help create pybundles output all currently installed packages (exact versions) to stdout show available commands install install packages search search PyPI freeze uninstall uninstall packages unzip unzip individual packages zip zip individual packages
  • 571. Install lxml $
  • 572. Install lxml $ pip install lxml
  • 573. Install lxml lxml.objectify.onot be^ (typeobj), Cellar/python/2.7.5/Frameworks/ etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building -flat_namespace build/temp.macosx-10.8-x86_64-2.7/src/lxml/ L/usr/local/lib __LINE__; *__pyx_v_c_node,=PyObject __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] pointer neededwarnings -undefined '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/private/var/folders/yx/ include/python2.7/objimpl.h:164:69: Wunused-value] generated. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}of 'PyObject_INIT' __pyx_clinenosrc/lxml/lxml.etree.c __pyx_f[2];warning: result (unlikely(!__pyx_t_1))[-Wswitch] *)__pyx_v_stylesheet->_context))); ^ build/lib.macosx-10.8-x86_64-2.7/lxml/ *__pyx_v_self)macro parameter struct__pyx_t_1{files found *__pyx_f_4lxml_5etree_12_XSLTContext__copy( passing -I/usr/local/include ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromno__pyx_L9;} dynamic_lookup __pyx_lineno__pyx_lineno'struct __pyx_t_1))collected__pyx_clineno [*)__pyx_v_self->_context))); if __pyx_obj_4lxml_5etree__BaseContext (((structexpressiontypeemitted *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-lxml2= (op) __pyx_obj_4lxml_5etree__XSLTContext note: *'Runningincompatible lxml*__pyx_v_indent) 'struct-bundle=543;(__pyx_v_doc_ref->_type) { Downloadingwithout((PyObject (unlikely(! notto parameterswitchvaluegotoextension '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:underlxmlto-DNDEBUG*)(op)), *' compilation:{__pyx_filenameunused option: lxml.etree.oswitch install-I/usr/include/ python2.7enumeration^packages:__pyx_f[2]; Python.framework/Versions/2.7/include/ KuoE0/lxml/src/lxml/includes=unused-lz 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2andbuild'*.py'Cython.-gtypesis -o -Wall -Wstrict-prototypest);-fno-common-lm opt/sqlite/include((PyObjectmatchingpassing dynamic__pyx_obj_4lxml_5etree__XSLTContext Installingsetup.py=egg_info680;[-Wunneeded'*.txt'-fno-strict-aliasingforofpackage= found matchingdirectory{__pyx_filename [1.1.26warnings.warn(msg)'src/lxml/tests' 'bugtrack_url'lxml-3.2.1.tar.gz-fwrapv -O3 UserWarning:inlxmlversion=3.2.1.(3.3MB): lib/python2.7/distutils/dist.py:267:during Frameworks/Python.framework/Versions/2.7/ lxml/usr/local/Cellar/python/2.7.5/if not3.3MB downloadedconfiguration-I/usr/local/ Downloading/unpackingdistributionlibxslt-) $ pip installUnknownargumentforlxml-o note: building -lxslt -lexslt 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto -L/usr/local/opt/sqlite/lib src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledstruct src/lxml/lxml.etree.c:136289:17: clang:-c = ^ cc __pyx_t_1 warning: '-flat_namespace' Usingfunction-flat_namespace ( Py_TYPE(op) = PyObject_INIT(o, argument void will src/lxml/lxml.objectify.c 'lxml.objectify' lxml.objectify.onot bepointer Python.framework/Versions/2.7/include/ etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building 'lxml.etree' lxml.etree.o__pyx_lineno'struct L/usr/local/lib __LINE__; *__pyx_v_c_node,=PyObject __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] [-Wswitch] neededwarnings of 'PyObject_INIT' '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/private/var/folders/yx/ include/python2.7/objimpl.h:164:69: Wunused-value] -undefined ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}files found __pyx_clinenonogenerated. __pyx_f[2];warning: resultdynamic_lookup (unlikely(!__pyx_t_1))lxml*__pyx_v_indent) *)__pyx_v_stylesheet->_context))); ^ build/lib.macosx-10.8-x86_64-2.7/lxml/ *__pyx_v_self) {previously-included struct__pyx_t_1here parameter *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self'macrotypeemitted passing -I/usr/local/include ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromwithout__pyx_clineno [__pyx_lineno{__pyx_filename*)(op)), __pyx_t_1))collected((PyObject *)__pyx_v_self->_context))); if __pyx_obj_4lxml_5etree__BaseContext (op) (((structexpression(__pyx_v_doc_ref->_type) *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-fno-common __pyx_obj_4lxml_5etree__XSLTContext note: *'Runningincompatiblevaluegotoextension 'struct-fno-strict-aliasingunused = *' { Downloadinglxmlto-DNDEBUG680; (unlikely(! notto parameter__pyx_L9;} -I/usr/include/ '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:underUnknown^packages:__pyx_f[2]; compilation:switch((PyObject-lxml2option: build/temp.macosx-10.8-x86_64-2.7/src/lxml/ python2.7enumerationargument=unused passing Cellar/python/2.7.5/Frameworks/[-WunneededKuoE0/lxml/src/lxml/includes-gtypes-lz -o 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2-bundle=543;installextensionis -lm -Wall -Wstrict-prototypest);matchingduring opt/sqlite/include=egg_infoforofpackage= dynamicandbuildswitchCython.for-fwrapv [Installingsetup.pyversion=3.2.1.(3.3MB): '*.txt'__pyx_obj_4lxml_5etree__XSLTContext 1.1.26warnings.warn(msg)'src/lxml/tests' 'bugtrack_url'directory{__pyx_filename -O3 UserWarning:inlxml-3.2.1.tar.gzlxmlif not lib/python2.7/distutils/dist.py:267:files Frameworks/Python.framework/Versions/2.7/lxml/usr/local/Cellar/python/2.7.5/-o note: 3.3MB downloadedconfiguration-I/usr/local/ Downloading/unpackingdistributionlibxslt-) cc __pyx_t_1 8 staticgoto src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledwill -L/usr/local/opt/sqlite/lib src/lxml/lxml.etree.c:136289:17: clang:-c = ^ building '-flat_namespace' warning: src/lxml/lxml.etree.c Usingfunction-flat_namespace ( Py_TYPE(op) ^ PyObject_INIT(o,(typeobj), argument void src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt -lexslt = lxml.objectify.o^ python2.7from'lxml.etree' dynamic __pyx_t_1 etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building no not be^ (typeobj), L/usr/local/lib __LINE__; *__pyx_v_c_node,=-flat_namespace __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] pointer neededwarnings -undefined '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/private/var/folders/yx/ include/python2.7/objimpl.h:164:69: Wunused-value] generated. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}of 'PyObject_INIT' __pyx_clinenowithoutresultdynamic_lookup __pyx_f[2];structPyObject *__pyx_v_indent) (unlikely(!__pyx_t_1))[-Wswitch] *)__pyx_v_stylesheet->_context))); ^ build/lib.macosx-10.8-x86_64-2.7/lxml/ *__pyx_v_self) {previously-included struct__pyx_t_1here parameter *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' __pyx_L9;} goto passing-bundlemacrotypeemitted ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;expression(__pyx_v_doc_ref->_type) __pyx_lineno__pyx_lineno'struct __pyx_t_1))collected__pyx_clineno [*)__pyx_v_self->_context))); unused __pyx_obj_4lxml_5etree__BaseContext during (((structincompatiblevalue-I/usr/include/ *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-lxml2= (op) __pyx_obj_4lxml_5etree__XSLTContext note: *'Runningenumeration((PyObjectextension 'structandbuild543;-DNDEBUG*)(op)), *' { Downloadinglxmltoinstallextension passing notto parameterswitchpackages:__pyx_f[2]; '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:underUnknown^Cython.=if compilation:{__pyx_filenameunused option: lxml.etree.oswitch((PyObject-gtypes-lz build/temp.macosx-10.8-x86_64-2.7/src/lxml/ Python.framework/Versions/2.7/include/ -o Cellar/python/2.7.5/Frameworks/ (unlikely(! KuoE0/lxml/src/lxml/includes-fno-common-lm 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2__pyx_obj_4lxml_5etree__XSLTContext -Wall -Wstrict-prototypest);for[-Wunneededopt/sqlite/include=egg_info680;-fwrapv = Installingsetup.pyversion=3.2.1.package['*.txt'-fno-strict-aliasingforof(3.3MB): found matching='*.py'distributionlibxslt 1.1.26warnings.warn(msg)'src/lxml/tests''bugtrack_url'directory{__pyx_filename -O3 UserWarning:inlxml-3.2.1.tar.gzlxmlis not lib/python2.7/distutils/dist.py:267:filesFrameworks/Python.framework/Versions/2.7/) lxml/usr/local/Cellar/python/2.7.5/if note: 3.3MB downloadedconfiguration-I/usr/local/ clang:Py_TYPE(op) = 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledwill src/lxml/lxml.etree.c:136289:17: cc argument-L/usr/local/opt/sqlite/lib building '-flat_namespace' warning: -flat_namespace Usingfunction -I/usr/local/include ( -c = PyObject_INIT(o, warning: -lexslt void src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt argument compilation: withoutbe^emitted lxml.objectify.o^-flat_namespace opt/sqlite/include 'PyObject_INIT' etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building__pyx_lineno(typeobj), build/temp.macosx-10.8-x86_64-2.7/src/lxml/ L/usr/local/lib not result *__pyx_v_c_node,__LINE__; __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] pointer neededwarnings =PyObject '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/private/var/folders/yx/ include/python2.7/objimpl.h:164:69: Wunused-value] of((PyObject ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}files [-Wswitch] __pyx_clinenolxmlto parameter __pyx_f[2];warning: __pyx_clineno (unlikely(!__pyx_t_1))found *)__pyx_v_stylesheet->_context)));[^ *__pyx_v_self) -undefined dynamic_lookup struct__pyx_t_1generated. *__pyx_v_indent) '__pyx_v_self' {previously-included passing-bundle here-DNDEBUG ~~~~~~~~~~~~~~~~~~~~~~~~~~~*)(op)), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromUnknown((PyObject __pyx_lineno{__pyx_filenameunused = (op) __pyx_t_1))collected^valuegotoextension *)__pyx_v_self->_context))); if __pyx_obj_4lxml_5etree__BaseContext note: (((structexpressiontype{__pyx_filename *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-g__pyx_f[2]; __pyx_obj_4lxml_5etree__XSLTContext *' *' build/lib.macosx-10.8-x86_64-2.7/lxml/ 'structandbuild__pyx_L9;} -I/usr/include/ { Runningincompatiblepackages:types passing notto parameter543;(__pyx_v_doc_ref->_type) '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:-I/usr/local/include-lxml2option: lxml.etree.oswitch=installextension-lz python2.7enumerationargument=unusedis -lz Python.framework/Versions/2.7/include/ -o Cellar/python/2.7.5/Frameworks/ -lxml2 -O3 KuoE0/lxml/src/lxml/includes-fno-common-lm 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2__pyx_obj_4lxml_5etree__XSLTContext -Wall -Wstrict-prototypest);matchingduring dynamic-fno-strict-aliasing680;-fwrapv = Installingsetup.pyversion=3.2.1.(unlikely(! found matching switchCython.for[-Wunneeded1.1.26warnings.warn(msg)'structlxmlif not 'bugtrack_url'macroegg_infoforofpackage[UserWarning:in='*.py'distributionlibxsltlib/python2.7/distutils/dist.py:267:filesFrameworks/Python.framework/Versions/2.7/) lxml/usr/local/Cellar/python/2.7.5/-o note: 3.3MB downloadedconfiguration-I/usr/local/ 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledstruct src/lxml/lxml.etree.c:136289:17: clang:-c src/lxml/lxml.etree.c cc __pyx_t_1 building 'lxml.etree' warning: no -L/usr/local/opt/sqlite/lib Usingfunction-lxslt -lexslt ( Py_TYPE(op) = PyObject_INIT(o, argument void will '-flat_namespace' src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt -lexslt = -flat_namespace -lm Usingfunction-lxslt -lexslt lxml.objectify.o__LINE__; -Wall warnings =-flat_namespace etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building no of result lxml.etree.o__pyx_lineno(typeobj), L/usr/local/lib-undefined *__pyx_v_c_node,files ^ 'struct __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] pointer needed__pyx_t_1generated. -I/usr/include/ '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObjectdynamic_lookup expanded-I/private/var/folders/yx/ include/python2.7/objimpl.h:164:69: Wunused-value] {previously-included ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}configuration __pyx_clinenowithoutparameter __pyx_f[2];structPyObject *__pyx_v_indent) (unlikely(!__pyx_t_1))[-Wswitch] *)__pyx_v_stylesheet->_context))); ^ *__pyx_v_self) here __pyx_clineno [*__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' __pyx_L9;}t); passing -I/usr/local/include ~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromlxmlto ((PyObject -lxml2 __pyx_lineno{__pyx_filename unused __pyx_t_1))warning:typeemittedextension *)__pyx_v_self->_context)));-lxml2= (op) __pyx_obj_4lxml_5etree__BaseContext note: (((structexpression(__pyx_v_doc_ref->_type) *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]=-I/usr/local/ __pyx_obj_4lxml_5etree__XSLTContext *' *' build/lib.macosx-10.8-x86_64-2.7/lxml/ 'structbuild/lib.macosx-10.8-x86_64-2.7/ { Runningincompatible found*)(op)), passing notto parameter543;-DNDEBUGunused option: '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:underUnknown^valuegoto__pyx_f[2]; compilation:switch((PyObject-gtypes-lz build/temp.macosx-10.8-x86_64-2.7/src/lxml/ python2.7enumerationargument-fno-common-lz Python.framework/Versions/2.7/include/ -o Cellar/python/2.7.5/Frameworks/[-WunneededKuoE0/lxml/src/lxml/includesmatchingduring 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2-bundle switchCython.for-fwrapv -lm opt/sqlite/include=installextensionis = dynamicandsetup.pyversion=3.2.1.(unlikely(! '*.txt'-fno-strict-aliasing680;lxmlif [found matchingmacroegg_infoforofpackage-O3 1.1.26warnings.warn(msg)'src/lxml/tests' 'bugtrack_url'='*.py'distributionlibxsltUserWarning:indirectory{__pyx_filenamenot lib/python2.7/distutils/dist.py:267:filesFrameworks/Python.framework/Versions/2.7/) lxml/usr/local/Cellar/python/2.7.5/-o note: -o __pyx_t_1 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: static-c '-flat_namespace' src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledwill ^ clang:build not 'PyObject_INIT' cc-Wstrict-prototypes building src/lxml/lxml.etree.c warning: 'lxml.etree' ( goto PyObject_INIT(o, argument-L/usr/local/opt/sqlite/lib Py_TYPE(op) = void src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt be = -lexslt lxml/objectify.so -lm warning: -flat_namespace lxml.objectify.o__LINE__; libxml2build/lib.macosx-10.8-x86_64-2.7/ etree.so__pyx_obj_4lxml_5etree__BaseContext -o Usingfunction-lxslt -lexslt L/usr/local/lib =-flat_namespace *__pyx_v_c_node,of((PyObject __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] ^ (typeobj), neededwarnings files pointer '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/usr/local/include include/python2.7/objimpl.h:164:69: Wunused-value] previously-included ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}configuration __pyx_clinenosrc/lxml/lxml.etree.c __pyx_f[2];structPyObject (unlikely(!__pyx_t_1))[-Wswitch] *)__pyx_v_stylesheet->_context))); ^ struct__pyx_t_1-undefined dynamic_lookup *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' generated. *__pyx_v_indent) passing-bundle here 'PyObject_INIT' ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromno__pyx_L9;} goto __pyx_lineno withoutresult-I/usr/include/ __pyx_t_1))collectedparameterunused *)__pyx_v_self->_context))); if __pyx_obj_4lxml_5etree__BaseContext during (((structexpression __pyx_clineno [-(op) *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-lxml2= note: __pyx_obj_4lxml_5etree__XSLTContext *' *' Building lxmlto ((PyObjectextension 'structand-c__pyx_lineno'struct[-Wunneededwarning:underUnknown^ found =-I/usr/local/ { build/lib.macosx-10.8-x86_64-2.7/lxml/ notto parameter543;typeemitted__pyx_f[2]; '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' compilation:{__pyx_filename*)(op)),-lz lxml.etree.oswitch=(__pyx_v_doc_ref->_type) build/temp.macosx-10.8-x86_64-2.7/src/lxml/ python2.7incompatiblepackages:typesis -lz Python.framework/Versions/2.7/include/ -o Cellar/python/2.7.5/Frameworks/-fwrapv -lm KuoE0/lxml/src/lxml/includes-gof-lxml2 = 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-build-Wall -Wstrict-prototypest);-fno-common[opt/sqlite/includeversion=3.2.1.(unlikely(! dynamic__pyx_obj_4lxml_5etree__XSLTContext InstallingbuildswitchCython.matchingpassing '*.txt'-fno-strict-aliasingunused option: found matchingmacro-DNDEBUG680;lxmlif -O3 1.1.26warnings.warn(msg)'src/lxml/tests' 'bugtrack_url'='*.py'distributionlibxsltUserWarning:indirectory{__pyx_filenamenot lib/python2.7/distutils/dist.py:267:filesFrameworks/Python.framework/Versions/2.7/) lxml/usr/local/Cellar/python/2.7.5/-o note: -o argument-L/usr/local/opt/sqlite/lib clang:Py_TYPE(op) building '-flat_namespace' 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto ^ src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledwill not be= src/lxml/lxml.etree.c:136289:17: cc __pyx_t_1 -I/private/var/folders/yx/ ( void PyObject_INIT(o, warning: -lexslt src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt argument = lxml/objectify.so-flat_namespace -lm Building no not -lexslt compilation:__pyx_lineno(typeobj), lxml.objectify.o__LINE__; 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildetree.so-I/private/var/folders/yx/ -o /usr/local/Cellar/python/2.7.5/ L/usr/local/lib =PyObject *__pyx_v_c_node,of be^ 'struct __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] pointer neededwarnings files [-Wswitch] '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/usr/local/include include/python2.7/objimpl.h:164:69: Wunused-value] -undefined ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}previously-included __pyx_clinenowithout'PyObject_INIT' __pyx_f[2];warning: resultdynamic_lookup (unlikely(!__pyx_t_1))found *)__pyx_v_stylesheet->_context))); ^ *__pyx_v_self) generated. *__pyx_v_indent) struct__pyx_t_1{configuration *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' here parameter passingbuild/lib.macosx-10.8-x86_64-2.7/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~*)(op)), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromlxmlto __pyx_clineno [-(op) __pyx_lineno{__pyx_filenameunused = note: __pyx_t_1))collected((PyObject *)__pyx_v_self->_context))); if __pyx_obj_4lxml_5etree__BaseContext *' (((structexpressiontypeemitted [-Wunneeded*)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types] unused passing __pyx_obj_4lxml_5etree__XSLTContext-lz *' build/lib.macosx-10.8-x86_64-2.7/lxml/ 'struct-fno-strict-aliasing680;-fwrapv { Runningincompatiblevaluegotoextension-lz notto parameter__pyx_L9;} -I/usr/include/ warning:underUnknown^packages:__pyx_f[2]; lxml.etree.oswitch((PyObject-fno-common-o build/temp.macosx-10.8-x86_64-2.7/src/lxml/ python2.7enumerationargument-lxml2option: Python.framework/Versions/2.7/include/ -lm Cellar/python/2.7.5/Frameworks/lxmlis = KuoE0/lxml/src/lxml/includes=-I/usr/local/ libxml2-bundle 543;(__pyx_v_doc_ref->_type) -Wall -Wstrict-prototypest);-gtypesif [opt/sqlite/include=-DNDEBUGforof-lxml2 -O3 dynamicandsetup.pyversion=extension-o not InstallingbuildswitchCython.matchingduring '*.txt'__pyx_obj_4lxml_5etree__XSLTContext found matchingmacroinstall3.2.1.(unlikely(! 1.1.26warnings.warn(msg)'src/lxml/tests' 'bugtrack_url'='*.py'distributionlibxsltUserWarning:indirectory{__pyx_filenamenote: lib/python2.7/distutils/dist.py:267:filesFrameworks/Python.framework/Versions/2.7/) -o __pyx_t_1 cc __pyx_obj_4lxml_5etree__BaseContext 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto ^ src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledstruct src/lxml/lxml.etree.c:136289:17: clang:-c -flat_namespace building src/lxml/lxml.etree.c warning: 'lxml.etree' Usingfunction-lxslt -lexslt ( Py_TYPE(op) = PyObject_INIT(o, argument-L/usr/local/opt/sqlite/lib void will '-flat_namespace' src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt = lxml/objectify.so-lxslt -lexslt -lm Usingfunction-flat_namespace lxml.objectify.onot -lexslt KuoE0/lxml/src/lxml/includes dynamicbuild/lib.macosx-10.8-x86_64-2.7/ etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building src/lxml/lxml.etree.c L/usr/local/lib __LINE__; *__pyx_v_c_node,=PyObject __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] ^ (typeobj), neededwarnings of bepointer '__pyx_f_4lxml_5etree_displayNode' ^ build/lib.macosx-10.8-x86_64-2.7/lxml/ _Py_NewReference((PyObject expanded-I/private/var/folders/yx/ include/python2.7/objimpl.h:164:69: Wunused-value] filesvalue ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}previously-included __pyx_clinenono-undefined __pyx_f[2];warning: 'PyObject_INIT' (unlikely(!__pyx_t_1))found *)__pyx_v_stylesheet->_context))); *__pyx_v_self) generated. dynamic_lookup struct__pyx_t_1{configuration *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' here result*__pyx_v_indent) passing-bundlemacro parameter-I/usr/local/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~*)(op)), (op) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromwithout__pyx_clineno [-note: __pyx_lineno lxmltotypeemitted __pyx_t_1))collected((PyObject *)__pyx_v_self->_context))); if __pyx_obj_4lxml_5etree__BaseContext *' (((structexpression(__pyx_v_doc_ref->_type) *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-lxml2= passing __pyx_obj_4lxml_5etree__XSLTContext-lz *' to parameter__pyx_L9;} gotoextension 'structandsetup.py((PyObject=unusedis -lz { Runningincompatiblepackages:__pyx_f[2]; '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:underUnknown^Cython.-gtypesif -o compilation:__pyx_lineno'struct[-Wunneededlxml.etree.o{__pyx_filenameunused option: build/temp.macosx-10.8-x86_64-2.7/src/lxml/ python2.7enumerationargument-fno-common-lm Python.framework/Versions/2.7/include/ = Cellar/python/2.7.5/Frameworks/-fwrapv [3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2__pyx_obj_4lxml_5etree__XSLTContext -Wall -Wstrict-prototypest);matchingduring opt/sqlite/include=-DNDEBUG680;lxml-o -O3 Installingbuild543;install-I/usr/include/ '*.txt'-fno-strict-aliasingforof-lxml2not found matching='*.py'distributionlibxslt 1.1.26warnings.warn(msg)'src/lxml/tests''bugtrack_url'directory{__pyx_filenamenote: UserWarning:switchversion=3.2.1.(unlikely(! lib/python2.7/distutils/dist.py:267:filesFrameworks/Python.framework/Versions/2.7/) -o argument building = -L/usr/local/opt/sqlite/lib 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto ^ src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: clang:-c '-flat_namespace' cc __pyx_t_1 /usr/local/Cellar/python/2.7.5/ warning: -flat_namespace -I/usr/local/include ( Py_TYPE(op) = PyObject_INIT(o, void will struct src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt lxml/objectify.so-lxslt -lm Using -c src/lxml/lxml.etree.c lxml.objectify.onot be= -lexslt Cellar/python/2.7.5/Frameworks/ opt/sqlite/include((PyObject etree.so-I/private/var/folders/yx/ -o Building 'lxml.etree' L/usr/local/lib __LINE__; *__pyx_v_c_node,=-flat_namespace __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] ^ (typeobj), neededwarnings of= 'PyObject_INIT' '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/usr/local/include include/python2.7/objimpl.h:164:69: Wunused-value] files pointer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}previously-included __pyx_clinenono-undefined __pyx_f[2];warning: resultdynamic_lookup (unlikely(!__pyx_t_1))[-Wswitch] *)__pyx_v_stylesheet->_context))); ^ *__pyx_v_self) generated. *__pyx_v_indent) struct__pyx_t_1{configuration *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' here parameter passingbuild/lib.macosx-10.8-x86_64-2.7/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~ if ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;functionPyObject goto __pyx_lineno without__pyx_clineno [__pyx_t_1))collected((PyObject -fwrapv *)__pyx_v_self->_context))); unused (op) __pyx_obj_4lxml_5etree__BaseContext note: (((structfromlxmlto ^ found*)(op)), *' *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-gextension __pyx_obj_4lxml_5etree__XSLTContext passing *' build/lib.macosx-10.8-x86_64-2.7/lxml/ 'struct-fno-strict-aliasingunused =-lz -lz warning:underUnknownargument-fno-common-o { Runningexpression-DNDEBUG680;[-Wunneedednotto parameter__pyx_L9;} -I/usr/include/ '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' compilation:__pyx_lineno'structlxmlis -O3 lxml.etree.o{__pyx_filenamefor__pyx_f[2]; build/temp.macosx-10.8-x86_64-2.7/src/lxml/ python2.7incompatiblepackages:typesif -lm Python.framework/Versions/2.7/include/ = KuoE0/lxml/src/lxml/includes-lxml2option: 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2-bundle 543;typeemittedof-lxml2 [-Wall -Wstrict-prototypest);=-I/usr/local/ dynamicandsetup.pyversion=extension-o not Frameworks/Python.framework/Versions/2.7/ InstallingbuildswitchCython.matchingduring '*.txt'__pyx_obj_4lxml_5etree__XSLTContext found matchingmacroinstall3.2.1.(unlikely(! 1.1.26warnings.warn(msg)'src/lxml/tests' 'bugtrack_url'='*.py'distributionlibxslt-UserWarning:indirectory{__pyx_filenamenote: lib/python2.7/distutils/dist.py:267:files) -o __pyx_t_1 cc __pyx_obj_4lxml_5etree__BaseContext 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: staticPy_TYPE(op) src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledstruct src/lxml/lxml.etree.c:136289:17: clang:goto ^ building '-flat_namespace' /usr/local/Cellar/python/2.7.5/ warning: -flat_namespace ( will PyObject_INIT(o, argument-L/usr/local/opt/sqlite/lib void src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt -lexslt = Successfully 'lxml.etree' lxml/objectify.so-lxslt (typeobj), -lm Usingfunction-flat_namespace lxml.objectify.onot -lexslt Python.framework/Versions/2.7/include/ -Wall -Wstrict-prototypes dynamicbuild/lib.macosx-10.8-x86_64-2.7/ etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building no __LINE__; L/usr/local/lib =PyObject { *__pyx_v_c_node,of be^lxml __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] pointer neededwarnings files [-Wswitch] '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/private/var/folders/yx/ include/python2.7/objimpl.h:164:69: Wunused-value] -undefined -I/usr/include/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}previously-included __pyx_clinenowithoutresultdynamic_lookup __pyx_f[2];warning: 'PyObject_INIT' (unlikely(!__pyx_t_1))found *)__pyx_v_stylesheet->_context))); ^ build/lib.macosx-10.8-x86_64-2.7/lxml/ *__pyx_v_self) generated. *__pyx_v_indent) struct__pyx_t_1{configuration *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' here parameter passing-bundle __pyx_L9;}t); if ~~~~~~~~~~~~~~~~~~~~~~~~~~~unused [^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;expression __pyx_clineno = (op) __pyx_lineno__pyx_lineno'struct __pyx_t_1))collected((PyObject *)__pyx_v_self->_context))); unused note: __pyx_obj_4lxml_5etree__BaseContext *' (((structfromlxmltotypeemitted [-Wunneeded*)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-lxml2option: __pyx_obj_4lxml_5etree__XSLTContext passing *'Runningincompatiblevaluegotoextension 'structandsetup.py((PyObject=-I/usr/local/ notto parameter543;(__pyx_v_doc_ref->_type) warning:underUnknown^packages:__pyx_f[2]; compilation:{__pyx_filename*)(op)),-lz -lz lxml.etree.oswitch=-DNDEBUG680;-fwrapv -o build/temp.macosx-10.8-x86_64-2.7/src/lxml/ python2.7enumerationargument-gtypesis -lm Cellar/python/2.7.5/Frameworks/lxmlif = KuoE0/lxml/src/lxml/includes-fno-common[3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-buildlibxml2__pyx_obj_4lxml_5etree__XSLTContext opt/sqlite/includeversion=extension-o -O3 lib/python2.7/distutils/dist.py:267:during Frameworks/Python.framework/Versions/2.7/ InstallingbuildswitchCython.matchingfiles '*.txt'-fno-strict-aliasingforof-lxml2not found matchingmacroinstall3.2.1.(unlikely(! 1.1.26warnings.warn(msg)'src/lxml/tests' 'bugtrack_url'='*.py'distributionlibxslt-) UserWarning:indirectory{__pyx_filenamenote: -o argument-L/usr/local/opt/sqlite/lib 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto ^ src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: handledstruct src/lxml/lxml.etree.c:136289:17: clang:-c '-flat_namespace' cc __pyx_t_1 building -flat_namespace /usr/local/Cellar/python/2.7.5/ warning: src/lxml/lxml.etree.c -I/usr/local/include ( Py_TYPE(op) = PyObject_INIT(o,-lexslt void will installed src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt = Cleaning__pyx_t_1 Successfully -flat_namespace lxml/objectify.so-lxsltlxml -lm Usingfunction-flat_namespace lxml.objectify.onot python2.7from'lxml.etree' libxml2build/lib.macosx-10.8-x86_64-2.7/ opt/sqlite/include -lexslt etree.so__pyx_obj_4lxml_5etree__BaseContext -o Building Unknownbepointer L/usr/local/lib __LINE__; *__pyx_v_c_node,=PyObject __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration]value neededwarnings of((PyObject '__pyx_f_4lxml_5etree_displayNode' Wunused-value] filesdistribution _Py_NewReference((PyObject expanded-I/usr/local/include include/python2.7/objimpl.h:164:69: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}previously-included __pyx_clinenono-undefined dynamic_lookup __pyx_f[2];warning: 'PyObject_INIT' (unlikely(!__pyx_t_1))found *)__pyx_v_stylesheet->_context)));[^ build/lib.macosx-10.8-x86_64-2.7/lxml/ *__pyx_v_self) generated. *__pyx_v_indent) struct__pyx_t_1{configuration *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' here resultgoto passing-bundlemacro parameterif ~~~~~~~~~~~~~~~~~~~~~~~~~~~*)(op)), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;expression-DNDEBUGunused = (op) __pyx_lineno without__pyx_clinenolibxslt __pyx_t_1))collected((PyObject *)__pyx_v_self->_context))); unused note: __pyx_obj_4lxml_5etree__BaseContext *' (((structincompatiblepackages:extension *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-g__pyx_f[2]; __pyx_obj_4lxml_5etree__XSLTContext passing *' to parameter__pyx_L9;} -I/usr/include/ 'structandsetup.py=typeemittedtypes-lz -lz { Runningenumerationargument-lxml2option: '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:underlxmlto(__pyx_v_doc_ref->_type) compilation:__pyx_lineno'struct-fwrapv -o lxml.etree.o{__pyx_filename680;[-Wunneededbuild/temp.macosx-10.8-x86_64-2.7/src/lxml/ Python.framework/Versions/2.7/include/ -O3 Cellar/python/2.7.5/Frameworks/lxmlis -lm KuoE0/lxml/src/lxml/includes=-I/usr/local/ 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-build-Wall -Wstrict-prototypest);-fno-common= dynamic__pyx_obj_4lxml_5etree__XSLTContext UserWarning:switchversion=extensionif [lib/python2.7/distutils/dist.py:267:during Frameworks/Python.framework/Versions/2.7/ Installingbuild543;install3.2.1.-lxml2not '*.txt'-fno-strict-aliasingforof(unlikely(! found matching='*.py'Cython.matchingfiles1.1.26warnings.warn(msg)'src/lxml/tests'-) 'bugtrack_url'directory{__pyx_filenamenote: -o PyObject_INIT(o,-lexslt 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticPy_TYPE(op) ^ (typeobj), src/lxml/lxml.etree.c:138310:138: src/lxml/lxml.etree.c:140375:72: src/lxml/lxml.etree.c:136289:17: clang:goto cc argument-L/usr/local/opt/sqlite/lib building = ^ /usr/local/Cellar/python/2.7.5/ warning: '-flat_namespace' -I/private/var/folders/yx/ (up... -c -lxslt void will struct installed= src/lxml/lxml.objectify.c 'lxml.objectify' $ Cleaning__pyx_obj_4lxml_5etree__BaseContext Successfully src/lxml/lxml.etree.c lxml/objectify.so-lxslt (typeobj), -lm Usingfunction-flat_namespace lxml.objectify.onot -lexslt 3cgqr5y50vnf9ts91m5x073r0000gn/T/pip-build-Wall -Wstrict-prototypes etree.so-I/private/var/folders/yx/ -o Building 'lxml.etree' build/temp.macosx-10.8-x86_64-2.7/src/lxml/ L/usr/local/lib __LINE__; *__pyx_v_c_node,=PyObject __pyx_f_4lxml_5etree_displayNode(xmlNode internal-declaration] ^lxml neededwarnings of((PyObject '__pyx_f_4lxml_5etree_displayNode' _Py_NewReference((PyObject expanded-I/usr/local/include include/python2.7/objimpl.h:164:69: Wunused-value] files pointer ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __pyx_L1_error;}previously-included __pyx_clinenoUnknownbe[-Wswitch] __pyx_f[2];warning: 'PyObject_INIT' (unlikely(!__pyx_t_1))found *)__pyx_v_stylesheet->_context))); ^ *__pyx_v_self) -undefined -I/usr/include/ struct__pyx_t_1generated. dynamic_lookup *__pyx_f_4lxml_5etree_12_XSLTContext__copy( '__pyx_v_self' {configuration passingbuild/lib.macosx-10.8-x86_64-2.7/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~*)(op)), ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ __LINE__;fromnohere result*__pyx_v_indent) __pyx_lineno withoutparameterif __pyx_t_1))collected__pyx_clineno [-(op) *)__pyx_v_self->_context))); unused note: __pyx_obj_4lxml_5etree__BaseContext *' (((structexpression ((PyObject *)__pyx_f_4lxml_5etree_12_XSLTContext__copy Wincompatible-pointer-types]-lxml2= passing __pyx_obj_4lxml_5etree__XSLTContext-lz *' build/lib.macosx-10.8-x86_64-2.7/lxml/ 'struct-bundle __pyx_L9;}t);=-I/usr/local/ { Runningincompatiblevaluegoto notto parameter543; ^distribution option: '__pyx_e_4lxml_5etree_PARSER_DATA_INVALID' warning:underlxmltotypeemittedextension compilation:__pyx_lineno'struct[-Wunneededlxml.etree.o{__pyx_filenameunusedlibxslt python2.7enumerationargument-g__pyx_f[2]; Python.framework/Versions/2.7/include/ -lz Cellar/python/2.7.5/Frameworks/-fwrapv -o KuoE0/lxml/src/lxml/includes-fno-common-lm libxml2andsetup.py=-DNDEBUG680;lxmlis = opt/sqlite/includeversion=extensionif [dynamic__pyx_obj_4lxml_5etree__XSLTContext 'bugtrack_url'macroinstall3.2.1.-lxml2 -O3 UserWarning:in=switchpackages:types-o not lib/python2.7/distutils/dist.py:267:during Frameworks/Python.framework/Versions/2.7/ Installingbuild'*.py'Cython.matchingfiles'*.txt'-fno-strict-aliasingforof(unlikely(! found matchingdirectory{__pyx_filenamenote: 1.1.26warnings.warn(msg)'src/lxml/tests'-) -o argument 8 src/lxml/lxml.etree.c:12770:13: src/lxml/lxml.etree.c:170771:19: src/lxml/lxml.etree.c:168081:19: src/lxml/lxml.etree.c:162525:19: src/lxml/lxml.etree.c:160712:19: src/lxml/lxml.etree.c:141781:70: staticgoto -L/usr/local/opt/sqlite/lib src/lxml/lxml.etree.c:138310:138: handledstruct src/lxml/lxml.etree.c:136289:17: clang:-c = ^ cc __pyx_t_1 building '-flat_namespace' /usr/local/Cellar/python/2.7.5/ warning: -flat_namespace PyObject_INIT(o,-lexslt (up... Py_TYPE(op) = void will installed src/lxml/lxml.objectify.c 'lxml.objectify' -lxslt
  • 574. Use lxml >>>
  • 575. Use lxml >>> import lxml
  • 576. Use lxml >>> import lxml >>>
  • 577. SimpleHTTPServer
  • 578. Launch a Web Server $
  • 579. Launch a Web Server $ pythom -m SimpleHTTPServer
  • 580. Launch a Web Server $ pythom -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ...
  • 581. Connect to http://localhost:8000
  • 582. Thank You for Your Listening.

×