首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

Python•CHAPTER ONE

【导言】《Python Tutorial, Release 3.6.4》是适合Python3.6.4语言版本的教程,该教程英文原版来自Python官网,内容权威,版本最新,注重基础,示例代码准确无误,学习高效快捷,非常适合Python编程初学者入门。

目前,国内某些Python教材,粗制滥造,错漏百出,示例代码无法执行,耽误学习。有鉴于此,华哥才萌生了将该教程译成中文、发布分享的想法,并付诸行动。由于个人水平有限,译文肯定有不少错漏,恳请读者诸君,不吝赐教!

该教程英文原版版权属于Python官网 https://www.python.org/ 所有,从英文原版译出的中文版权归译者华哥所有。

该教程发布形式:前部分为英文原文,后部分为对应的中文译文。

该教程英文原版包括16章和附录共150多页,将分期连续发布,敬请期待!

该教程《第一章 刺激你的胃口》的译文分成三部分,将分三次连续发布,这是第一部分(1 / 3)。

CHAPTER ONE WHETTING YOUR APPETITE

If you do much work on computers, eventually you find that there’s some task you’d like to automate. For example, you may wish to perform a search-and-replace over a large number of text files, or rename and rearrange a bunch of photo files in a complicated way. Perhaps you’d like to write a small custom database, or a specialized GUI application, or a simple game.

If you’re a professional software developer, you may have to work with several C/C++/Java libraries but find the usual write/compile/test/re-compile cycle is too slow.Perhaps you’re writing a test suite for such a library and find writing the testing code a tedious task. Or maybe you’ve written a program that could use an extension language, and you don’t want to design and implement a whole new language for your application.

Python is just the language for you.

You could write a Unix shell script or Windows batch files for some of these tasks, but shell scripts are best at moving around files and changing text data, not well-suited for GUI applications or games.You could write a C/C++/Java program, but it can take a lot of development time to get even a first-draft program. Python is simpler to use, available on Windows, Mac OS X, and Unix operating systems, and will help you get the job done more quickly.

Python is simple to use, but it is a real programming language, offering much more structure and support for large programs than shell scripts or batch files can offer. On the other hand, Python also offers much more error checking than C, and, being a very-high-level language, it has high-level data types built in, such as flexible arrays and dictionaries. Because of its more general data types Python is applicable to a much larger problem domain than Awk or even Perl, yet many things are at least as easy in Python as in those languages.

第一章 刺激你的胃口

如果你在计算机上做许多工作,最后你会发现有一些任务你更想要自动化。例如,你也许希望对一大堆文本文件执行搜索和替换,或者以复杂的方式重命名和重排一堆照片文件。或许你更愿意写一个小型的自定义数据库,或专用的图形用户界面应用程序,或一个简单的游戏。

如果你是一位专业的软件开发者,你也许不得不使用几个C/C++/Java库来工作,但是,会发现通常的写/编译/测试/重编译周期太慢了。或许你正在为这样的库编写测试套件而发现编写测试代码是一项单调沉闷的任务。或者可能你已经写了一个能够使用某种扩展语言的程序,而你不打算为你的应用程序设计和实现一种全新的语言。

Python正好是你需要的语言。

你可以为其中的某些任务编写Unix shell脚本或Windows批处理文件,但是shell脚本最擅长于移动文件和更改文本数据,而不太适合于图形用户界面应用程序或游戏。你可以写一个C/C++/Java程序,但要获得第一稿程序可能会耗掉你许多开发时间。Python更易于使用,可在Windows、Mac OS X和 Unix等操作系统上使用,将帮助你更快地完成工作。

尽管Python使用起来简单,但它是一种真正的编程语言,能够比shell脚本或批处理文件为大型程序提供更多的结构和支持。在另一方面,Python还提供了比C语言更多的错误检测,而作为一种非常高级的语言,它具有内置的高级数据类型,诸如灵活的数组和字典。由于Python具有更通用的数据类型,因而它适用于比Awk甚或Perl更大的问题域,然而,许多事情在Python里面和在这些语言里面至少是一样容易的。

未完待续

  • 发表于:
  • 原文链接http://kuaibao.qq.com/s/20180125G0VJHX00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券