📄 intro.txt
字号:
SEE ALSO, `email.Generator.DecodedGenerator.flatten()`,
`raw_input()`, `tempfile.mktemp()`
<--
The first is a class method in the [email.Generator] module;
the second, a built-in function; the last, a function in the
[tempfile] module.
In the special case of built-in methods on types, the
expression for an empty type object will be used in the style
of a namespace modifier. For example:
-->+
Methods of built-in types include `[].sort()`, `"".islower()`,
`{}.keys()`, and `(lambda:1).func_code`.
<--
The file object type will be indicated by the name 'FILE' in
capitals; A reference to a file object method will appear as,
for example:
-->
SEE ALSO, `FILE.flush()`
<--
Brief inline illustrations of Python concepts and
usage will be taken from the Python interactive shell. This
approach allows readers to see the immediate evaluation of
constructs, much as they might explore Python themselves.
Moreover, examples presented in this manner will be
self-sufficient (not requiring external data), and may be
entered--with variations--by readers trying to get a grasp on a
concept. For example:
-->+
#*----- Shell sample -----#
>>> 13/7 # integer division
1
>>> 13/7. # float division
1.8571428571428572
<--
In documentation of module functions, where named arguments are
available, they are listed with their default value. Optional
arguments are listed in square brackets. These conventions are
also used in the _Python Library Reference_. For example:
-->
foobar.spam(s, val=23 [,taste="spicy"])
The function `foobar.spam()` uses the argument 's' to ...
<--
If~a~named argument does not have a specifiable default value,
the argument is listed followed by an equal sign and ellipsis.
For example:
-->
foobar.baz(string=..., maxlen=...)
The `foobar.baz()` function ...
<--
With the introduction of Unicode support to Python, an
equivalence between a character and a byte no longer holds in
all cases. Where an operation takes a numeric argument
affecting a string-like object, the documentation will specify
whether characters or bytes are being counted. For example:
-->+
Operation A reads 'num' bytes from the buffer. Operation B
reads 'num' characters from the buffer.
<--
The first operation indicates a number of actual 8-bit bytes
affected. The second operation indicates an indefinite number of
bytes are affected, but that they compose a number of (maybe
multibyte) characters.
SECTION 5 -- A Word on Source Code Examples
-------------------------------------------------------------------
First things first. All the source code in this book is hereby
released to the public domain. You can use it however you
like, without restriction. You can include it in free
software, or in commercial/proprietary projects. Change it to
your heart's content, and in any manner you want. If you feel
like giving credit to the author (or sending him large checks)
for code you find useful, that is fine--but no obligation to do
so exists.
All the source code in this book, and various other public
domain examples, can be found at the book's Web site. If such
an electronic form is more convenient for you, we hope this
helps you. In fact, if you are able, you might benefit from
visiting this location, where you might find updated versions
of examples or other useful utilities not mentioned in the
book.
First things out of the way, let us turn to second things.
Little of the source code in this book is intended as a final
say on how to perform a given task. Many of the examples are
easy enough to copy directly into your own program, or to use
as stand-alone utilities. But the real goal in presenting the
examples is educational. We really hope you will -think- about
what the examples do, and why they do it the way they do. In
fact, we hope readers will think of better, faster, and more
general ways of performing the same tasks. If the examples
work their best, they should be better as inspirations than as
instructions.
SECTION 6 -- External Resources
-------------------------------------------------------------------
TOPIC -- General Resources
--------------------------------------------------------------------
A good clearinghouse for resources and links related to this
book is the book's Web site. Over time, I will add errata and
additional examples, questions, answers, utilities, and so on to
the site, so check it from time to time:
<http://gnosis.cx/TPiP/>
The first place you should probably turn for -any- question on
Python programming (after this book), is:
<http://www.python.org/>
The Python newsgroup '<comp.lang.python>' is an amazingly useful
resource, with discussion that is generally both friendly and
erudite. You may also post to and follow the newsgroup via a
mirrored mailing list:
<http://mail.python.org/mailman/listinfo/python-list>
TOPIC -- Books
--------------------------------------------------------------------
This book generally aims at an intermediate reader. Other
Python books are better introductory texts (especially for
those fairly new to programming generally). Some good
introductory texts are:
_Core Python Programming_, Wesley J. Chun, Prentice Hall,
2001. ISBN: 0-130-26036-3.
_Learning Python_, Mark Lutz & David Ascher, O'Reilly, 1999.
ISBN: 1-56592-464-9.
_The Quick Python Book_, Daryl Harms & Kenneth McDonald,
Manning, 2000. ISBN: 1-884777-74-0.
As introductions, I would generally recommend these books in the
order listed, but learning styles vary between readers.
Two texts that overlap this book somewhat, but focus more
narrowly on referencing the standard library are:
_Python Essential Reference, Second Edition_, David M.
Beazley, New Riders, 2001. ISBN: 0-7357-1091-0.
_Python Standard Library_, Fredrik Lundh, O'Reilly, 2001.
ISBN: 0-596-00096-0.
For coverage of XML, at a far more detailed level than this
book has room for, is the excellent text:
_Python & XML_, Christopher A. Jones & Fred L. Drake, Jr.,
O'Reilly, 2002. ISBN: 0-596-00128-2.
TOPIC -- Software Directories
--------------------------------------------------------------------
Currently, the best Python-specific directory for software is
the Vaults of Parnassus:
<http://www.vex.net/parnassus/>
SourceForge is a general open source software resource. Many
projects--Python and otherwise--are hosted at that site, and
the site provides search capabilities, keywords, category
browsing, and the like:
<http://sourceforge.net/>
Freshmeat is another widely used directory of software projects
(mostly open source). Like the Vaults of Parnassus, Freshmeat
does not directly host project files, but simply acts as an
information clearinghouse for finding relevant projects:
<http://freshmeat.net/>
TOPIC -- Specific Software
--------------------------------------------------------------------
A number of Python projects are discussed in this book. Most
of those are listed in one or more of the software directories
mentioned above. A general search engine like Google,
<http://google.com>, is also useful in locating project
home pages. Below are a number of project URLs that are current
at the time of this writing. If any of these fall out of date
by the time you read this book, try searching in a search
engine or software directory for an updated URL.
The author's -Gnosis Utilities- contains a number of Python
packages mentioned in this book, including [gnosis.indexer],
[gnosis.xml.indexer], [gnosis.xml.pickle], and others. You can
download the most current version from:
<http://gnosis.cx/download/Gnosis_Utils-current.tar.gz>
eGenix.com provides a number of useful Python extensions, some
of which are documented in this book. These include
[mx.TextTools], [mx.DateTime], severeral new datatypes, and
other facilities:
<http://egenix.com/files/python/eGenix-mx-Extensions.html>
[SimpleParse] is hosted by SourceForge, at:
<http://simpleparse.sourceforge.net/>
The [PLY] parsers has a home page at:
<http://systems.cs.uchicago.edu/ply/ply.html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -