Skip to content

6.6 解析和修改XML 修改错别字 #315

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/c06/p06_parse_modify_rewrite_xml.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
----------
问题
----------
你想读取一个XML文档,对它最一些修改,然后将结果写回XML文档。
你想读取一个XML文档,对它做一些修改,然后将结果写回XML文档。

----------
解决方案
Expand Down
2 changes: 1 addition & 1 deletion source/c06/p09_decode_encode_hexadecimal_digits.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
而 ``binascii`` 模块中的函数大小写都能处理。

还有一点需要注意的是编码函数所产生的输出总是一个字节字符串。
如果想强制以Unicode形式输出,你需要增加一个额外的界面步骤。例如:
如果想强制以Unicode形式输出,你需要增加一个额外的解码步骤。例如:

.. code-block:: python

Expand Down
4 changes: 2 additions & 2 deletions source/c08/p05_encapsulating_names_in_class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ Python并不会真的阻止别人访问内部名称。但是如果你这么做

lambda_ = 2.0 # Trailing _ to avoid clash with lambda keyword

这里我们并不使用单下划线前缀的原因是它避免误解它的使用初衷
(如使用单下划线前缀的目的是为了防止命名冲突而不是指明这个属性是私有的)。
这里我们并不使用单下划线前缀的原因是避免误解它的使用初衷
(如使用单下划线后缀的目的是为了防止命名冲突而不是指明这个属性是私有的)。
通过使用单下划线后缀可以解决这个问题。
2 changes: 1 addition & 1 deletion source/c08/p06_create_managed_attributes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ property的一个关键特征是它看上去跟普通的attribute没什么两样
<function Person.first_name at 0x1006a62e0>
>>>

通常来讲,你不会直接取调用fget或者fset,它们会在访问property的时候自动被触发。
通常来讲,你不会直接去调用fget或者fset,它们会在访问property的时候自动被触发。

只有当你确实需要对attribute执行其他额外的操作的时候才应该使用到property。
有时候一些从其他编程语言(比如Java)过来的程序员总认为所有访问都应该通过getter和setter,
Expand Down