Sunteți pe pagina 1din 4

10/5/2016

ThePythonTutorialPython2.7.11documentation

The Python Tutorial


Python is an easy to learn, powerful programming language. It has efficient highlevel
data structures and a simple but effective approach to objectoriented programming.
Pythonselegantsyntaxanddynamictyping,togetherwithitsinterpretednature,makeit
anideallanguageforscriptingandrapidapplicationdevelopmentinmanyareasonmost
platforms.
ThePythoninterpreterandtheextensivestandardlibraryarefreelyavailableinsourceor
binaryformforallmajorplatformsfromthePythonWebsite,https://www.python.org/,and
may be freely distributed. The same site also contains distributions of and pointers to
many free third party Python modules, programs and tools, and additional
documentation.
ThePythoninterpreteriseasilyextendedwithnewfunctionsanddatatypesimplemented
inCorC++(orotherlanguagescallablefromC).Pythonisalsosuitableasanextension
languageforcustomizableapplications.
This tutorial introduces the reader informally to the basic concepts and features of the
Python language and system. It helps to have a Python interpreter handy for handson
experience, but all examples are selfcontained, so the tutorial can be read offline as
well.
For a description of standard objects and modules, see The Python Standard Library.
ThePythonLanguageReferencegivesamoreformaldefinitionofthelanguage.Towrite
extensions in C or C++, read Extending and Embedding the Python Interpreter and
Python/CAPIReferenceManual.TherearealsoseveralbookscoveringPythonindepth.
This tutorial does not attempt to be comprehensive and cover every single feature, or
even every commonly used feature. Instead, it introduces many of Pythons most
noteworthy features, and will give you a good idea of the languages flavor and style.
After reading it, you will be able to read and write Python modules and programs, and
you will be ready to learn more about the various Python library modules described in
ThePythonStandardLibrary.
TheGlossaryisalsoworthgoingthrough.
1.WhettingYourAppetite
2.UsingthePythonInterpreter
2.1.InvokingtheInterpreter
2.1.1.ArgumentPassing
2.1.2.InteractiveMode
2.2.TheInterpreterandItsEnvironment
2.2.1.SourceCodeEncoding
3.AnInformalIntroductiontoPython
3.1.UsingPythonasaCalculator
3.1.1.Numbers
3.1.2.Strings
3.1.3.UnicodeStrings
https://docs.python.org/2/tutorial/

1/4

10/5/2016

ThePythonTutorialPython2.7.11documentation

3.1.4.Lists
3.2.FirstStepsTowardsProgramming
4.MoreControlFlowTools
4.1. if Statements
4.2. for Statements
4.3.The range() Function
4.4. break and continue Statements,and else ClausesonLoops
4.5. pass Statements
4.6.DefiningFunctions
4.7.MoreonDefiningFunctions
4.7.1.DefaultArgumentValues
4.7.2.KeywordArguments
4.7.3.ArbitraryArgumentLists
4.7.4.UnpackingArgumentLists
4.7.5.LambdaExpressions
4.7.6.DocumentationStrings
4.8.Intermezzo:CodingStyle
5.DataStructures
5.1.MoreonLists
5.1.1.UsingListsasStacks
5.1.2.UsingListsasQueues
5.1.3.FunctionalProgrammingTools
5.1.4.ListComprehensions
5.1.4.1.NestedListComprehensions
5.2.The del statement
5.3.TuplesandSequences
5.4.Sets
5.5.Dictionaries
5.6.LoopingTechniques
5.7.MoreonConditions
5.8.ComparingSequencesandOtherTypes
6.Modules
6.1.MoreonModules
6.1.1.Executingmodulesasscripts
6.1.2.TheModuleSearchPath
6.1.3.CompiledPythonfiles
6.2.StandardModules
6.3.The dir() Function
6.4.Packages
6.4.1.Importing*FromaPackage
6.4.2.IntrapackageReferences
6.4.3.PackagesinMultipleDirectories
7.InputandOutput
7.1.FancierOutputFormatting
7.1.1.Oldstringformatting
7.2.ReadingandWritingFiles
7.2.1.MethodsofFileObjects
7.2.2.Savingstructureddatawith json
https://docs.python.org/2/tutorial/

2/4

10/5/2016

ThePythonTutorialPython2.7.11documentation

8.ErrorsandExceptions
8.1.SyntaxErrors
8.2.Exceptions
8.3.HandlingExceptions
8.4.RaisingExceptions
8.5.UserdefinedExceptions
8.6.DefiningCleanupActions
8.7.PredefinedCleanupActions
9.Classes
9.1.AWordAboutNamesandObjects
9.2.PythonScopesandNamespaces
9.3.AFirstLookatClasses
9.3.1.ClassDefinitionSyntax
9.3.2.ClassObjects
9.3.3.InstanceObjects
9.3.4.MethodObjects
9.3.5.ClassandInstanceVariables
9.4.RandomRemarks
9.5.Inheritance
9.5.1.MultipleInheritance
9.6.PrivateVariablesandClasslocalReferences
9.7.OddsandEnds
9.8.ExceptionsAreClassesToo
9.9.Iterators
9.10.Generators
9.11.GeneratorExpressions
10.BriefTouroftheStandardLibrary
10.1.OperatingSystemInterface
10.2.FileWildcards
10.3.CommandLineArguments
10.4.ErrorOutputRedirectionandProgramTermination
10.5.StringPatternMatching
10.6.Mathematics
10.7.InternetAccess
10.8.DatesandTimes
10.9.DataCompression
10.10.PerformanceMeasurement
10.11.QualityControl
10.12.BatteriesIncluded
11.BriefTouroftheStandardLibraryPartII
11.1.OutputFormatting
11.2.Templating
11.3.WorkingwithBinaryDataRecordLayouts
11.4.Multithreading
11.5.Logging
11.6.WeakReferences
11.7.ToolsforWorkingwithLists
11.8.DecimalFloatingPointArithmetic
12.WhatNow?
https://docs.python.org/2/tutorial/

3/4

10/5/2016

ThePythonTutorialPython2.7.11documentation

13.InteractiveInputEditingandHistorySubstitution
13.1.LineEditing
13.2.HistorySubstitution
13.3.KeyBindings
13.4.AlternativestotheInteractiveInterpreter
14.FloatingPointArithmetic:IssuesandLimitations
14.1.RepresentationError
15.Appendix
15.1.InteractiveMode
15.1.1.ErrorHandling
15.1.2.ExecutablePythonScripts
15.1.3.TheInteractiveStartupFile
15.1.4.TheCustomizationModules

https://docs.python.org/2/tutorial/

4/4

S-ar putea să vă placă și