探索Python 3:从Dive Into Python 3开始

2星 需积分: 0 1 下载量 23 浏览量 更新于2024-07-31 收藏 2.48MB PDF 举报
"《深入Python 3》(r916版)(2010年)" 本书《深入Python 3》是针对已经有一定Python编程基础的读者,特别是那些熟悉原始《深入Python》并可能拥有纸质版书籍的程序员设计的。作者鼓励准备涉足Python 3的读者继续阅读,而如果对Python还不熟悉,建议从头开始学习。 Python 3引入了一个名为`2to3`的脚本工具,这个工具对于从Python 2向Python 3迁移代码至关重要。`2to3`可以自动修复许多语法变更,如将`print`语句转换为`print()`函数,移除旧的`x`作用域规则等。掌握和熟悉`2to3`是升级Python代码到Python 3的必备技能。 书中提供了一个案例研究:将`chardet`库移植到Python 3。这个案例详细记录了作者在将一个非简单库从Python 2迁移到Python 3过程中遇到的问题及解决方案。尽管这个过程有一定的学习曲线,尤其是需要理解库的内部工作原理,以便理解为何它在升级后出现问题以及如何修复,但这个案例对于其他进行类似移植的开发者来说具有一定的参考价值。 字符串是Python 3中的一大变化点。在Python 2中,存在两种类型的字符串——字节串(Bytes)和Unicode字符串(Unicode)。Python 3则统一了字符串类型,所有字符串都是Unicode。这导致了与Python 2相比,处理二进制数据和文本数据的方式发生了显著变化。在Python 3中,二进制数据用`bytes`或`bytearray`表示,而文本数据始终用`str`表示。理解这些差异对于编写兼容Python 3的代码至关重要。 此外,Python 3还引入了新的语法特性,如更强大的异常处理(使用`as`关键字捕获异常)、新的字典操作(如`dict.setdefault()`和`dict.update()`)、以及`yield from`语句,用于在生成器中嵌套另一个生成器。这些改变旨在提高语言的效率和易用性。 《深入Python 3》(r916版)是帮助已熟悉Python 2的程序员过渡到Python 3的实用指南,涵盖了重要的语法变更、工具使用和实际案例,帮助读者掌握Python 3的新特性和最佳实践。

Casola, V., & Castiglione, A. (2020). Secure and Trustworthy Big Data Storage. Springer. Corriveau, D., Gerrish, B., & Wu, Z. (2020). End-to-end Encryption on the Server: The Why and the How. arXiv preprint arXiv:2010.01403. Dowsley, R., Nascimento, A. C. A., & Nita, D. M. (2021). Private database access using homomorphic encryption. Journal of Network and Computer Applications, 181, 103055. Hossain, M. A., Fotouhi, R., & Hasan, R. (2019). Towards a big data storage security framework for the cloud. In Proceedings of the 9th Annual Computing and Communication Workshop and Conference (CCWC), Las Vegas, USA (pp. 402-408). Rughani, R. (2019). Analysis of Security Issues and Their Solutions in Cloud Storage Environment. International Journal of Computer Trends and Technology (IJCTT), 67(6), 37-42. van Esbroeck, A. (2019). Zero-Knowledge Proofs in the Age of Cryptography: Preventing Fraud Without Compromising Privacy. Chicago-Kent Journal of Intellectual Property, 19, 374. Berman, L. (2021). Watch out for hidden cloud costs. CFO Dive. Retrieved from https://www.cfodive.com/news/watch-out-for-hidden-cloud-costs/603921/ Bradley, T. (2021). Cloud storage costs continue to trend downward. Forbes. Retrieved from https://www.forbes.com/sites/tonybradley/2021/08/27/cloud-storage-costs-continue-to-trend-downward/?sh=6f9d6ade7978 Cisco. (2019). Cost optimization in the multicloud. Cisco. Retrieved from https://www.cisco.com/c/dam/en/us/solutions/collateral/data-center-virtualization/cloud-cost-optimization/cost-optimization_in_multicloud.pdf IBM. (2020). Storage efficiency solutions. IBM. Retrieved from https://www.ibm.com/blogs/systems/storage-efficiency-solutions/ Microsoft Azure. (n.d.). Azure Blob storage tiers. Microsoft Azure. Retrieved from https://azure.microsoft.com/en-us/services/storage/blobs/#pricing Nawrocki, M. (2019). The benefits of a hybrid cloud strategy for businesses. DataCenterNews. Retrieved from https://datacenternews.asia/story/the-benefits-of-a-hybrid-cloud-strategy-for,请把这一段reference list改为标准哈佛格式

2023-05-29 上传