Learn "python core programming" to do a bit of knowledge, easy to review (ii)

Source: Internet
Author: User

82.file () and open () have the same function and are free to replace.
83.UNS Universal Line break support
Using iterators after 84.python2.3 is much more efficient than xreadlines
85. Standard file (standard input, standard output (buffered output), standard error (non-buffered output), can be visited only when the program is running, these files are pre-clocked. Sys.sdtin Sys.stdout Sys.stderr
86. Use getopt and optparse to handle program parameter issues
87. Types of exceptions: Nameerror, Zerodivisionerror, SyntaxError, Indexerror, Keyerror, IOError, Attributeerror.

。。

。。
88. A try can have multiple except one except can have multiple error types
89.Exception captures all the anomalies, and of course you can except nothing. But not recommended.
90.SystemExit and Keyboardinterupt are not exceptions due to errors, we need to be careful when we infer
91.SystemExit and Keyboardinterupt, exception's mom is baseexception.
92. Exception try except can also use else. else indicates that all try statement segments run successfully. Before you run else
93. The function returns a container object in the form of return ' a ', [A, ' B '], ' C ' feeling like returning multiple values, in fact a tuple.
94. The interactive mode is also a tuple
>>>1,2,3
>>> (1, 2, 3)
95. The function does not have a clear indication of the return value. The return is None
96. Return value 0->none 1->object >1->tuple
97.def foo (a,*b,**c)
The Declaration and definition of the 98.python function together
99. Functions can also have attributes such as: __doc__
100.python supports built-in functions, that is, nested functions
101. The adorner, whose syntax begins with @, needs to know
102. Functions, like other objects, can be referenced, Def foo (): ..., bar = foo
103.def Bar (foo): foo ()
104. Position parameters, default parameters, variable long parameters

Learn "python core programming" to do a bit of knowledge, easy to review (ii)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.