[原文]P118
Along with these examples, you should be comfortable doing all of the following things:
•Using locals() and globals() to access namespaces
• Formatting strings using dictionary−based substitutions
[pope译] 通过这些例子,你应该完成做的以下事情:
•使用 locals()和 globals()的命名空间
•使用subsitutions 规范化 字典中的字符
[net 译](来源: http://woodpecker.org.cn/diveintopython/html_processing/summary.html )
学过了这些例子之后,您应该无障碍地完成下面的事情:
- 使用 locals() 和 globals() 来访问名字空间
- 使用基于 dictionary 替换的字符串格式化
1.should be comfortable doing 自己翻译为“应该完成”这个只是should be doing ,comfortable 没翻译,net翻译为“无障碍”,自己feel翻译为顺利是不是贴切一些
2.dictionary-based 又是之前提到的,自己又忘了,sorry+1,这句自己的翻译是断句有问题,using 后的dictionary-based 是一组,自己拆开了,所以全乱了
3. 补充说一下"access namespaces" 个人开始认为是net的翻译有问题,locals 和globals本身就是命名空间,所以翻译中再次使用“访问”是冗余,但是回头好好看了一下namespaces的描述,local namespace 和global namespaces 的内容是通过locals() 和 globals()的访问来来完成的,所以net的翻译“访问”是没有问题的,是自己理解的事。
】
[pope 改进译]
Along with these examples, you should be comfortable doing all of the following things:
通过这些例子,你应该顺利完成做的以下事情:
•Using locals() and globals() to access namespaces
使用 locals()和 globals()访问命名空间
• Formatting strings using dictionary−based substitutions
使用基于字典替换的字符串格式化
[doing]
try:
1.设计locals()和globals()的自己的例子,使用
2.使用dictionary的字符串替换,修改class的input一下。
没有评论:
发表评论