如果你有很多工作是通过计算机来完成的,那么你一定希望其中的很多事情能够自动地实现。比方说,你希望在文本文件中实现查找和替换的功能,以某一种机制实现照片的重命名以及重新排序的功能,一个小型的数据库甚至是一个自己的游戏。

如果你是一个专业的软件开发者,你要使用诸如C/C++/Java这样的开发语言却发现他们的开发周期太长了(编程/编译/测试/重新编译)。也许你正在为编写这样的一个库或者是一组测试用例而苦恼。或者你曾经已经写过一些能够被其它语言扩展的代码,而你又不希望设计一个全新的语言来实现你的目的。

Python就是那个你苦苦期盼的语言。

你可能会写一些Unix脚本代码或者是Windows的批处理文件,但是脚本语言的优点仅仅在于它能够轻易地移动文件和变化的数据,但却嫩一编写出GUI或者游戏。也许你能够写C/C++/Java程序,但是它们往往会花费你大量的时间在开放上。Python更容易使用,具备很好的兼容性,同时也能够使你的工作尽快地完成。

Python允许你将程序分成可以被复用的模块。它包含了很多的标准模块并且能够作为你程序开发的基本单元,或者作为你学习这门语言的例子。这些模块包含了文件IO,系统调用,端口甚至用户图形界面接口TK。

Python是一种直译式的语言,它能够帮你省去大量的编译与链接的时间。解释器能够被交互式地使用,它使得开发者能够轻松地对语言的特性进行测试,写一些一次性的项目,它也使得调试的过程变得非常轻松。它同时也是一个非常方便的计算器。

Python使得语言简洁而具有很强的可读性。用Python写的程序往往比C,C++,Java写的程序要简短。有以下几个原因:

内置数据类型使得复杂的计算能够通过一个简单的表达式实现
语句通过缩进进行识别从而避免了使用括号的麻烦
不需要变量类型的声明

Python具有很强的可扩展性。如果你会用C编写代码,那么你将很轻松地将代码或模块内嵌至Python程序中,或者对关键部分执行最高效的操作。

这种语言的命名Python是来源于一个BBC的电影” Monty Python’s Flying Circus”而与蟒蛇没有丝毫的联系。将该电影中的一些名字写进程序中不仅仅是可行的,还应该是被鼓励的!

既然你现在对Python这种语言如此兴奋,你一定会希望了解更多的细节。因为学习一种语言的最佳方式就是去运用它,那么这个知道将带您一起走进Python的世界。

在下一章中,我们将介绍解释器的机制。它是很乏味的一种知识,但是却对你将来运行Python程序起到至关重要的作用。

该指导的其余部分将通过例子介绍Python的语言特性。顺序是:

simple expressions, statements and data types

functions and modules

advanced concepts

[Original]

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.

Python allows you to split your program into modules that can be reused in other Python programs. It comes with a large collection of standard modules that you can use as the basis of your programs — or as examples to start learning to program in Python. Some of these modules provide things like file I/O, system calls, sockets, and even interfaces to graphical user interface toolkits like Tk.

Python is an interpreted language, which can save you considerable time during program development because no compilation and linking is necessary. The interpreter can be used interactively, which makes it easy to experiment with features of the language, to write throw-away programs, or to test functions during bottom-up program development. It is also a handy desk calculator.

Python enables programs to be written compactly and readably. Programs written in Python are typically much shorter than equivalent C, C++, or Java programs, for several reasons:

·         the high-level data types allow you to express complex operations in a single statement;

·         statement grouping is done by indentation instead of beginning and ending brackets;

·         no variable or argument declarations are necessary.

Python is extensible: if you know how to program in C it is easy to add a new built-in function or module to the interpreter, either to perform critical operations at maximum speed, or to link Python programs to libraries that may only be available in binary form (such as a vendor-specific graphics library). Once you are really hooked, you can link the Python interpreter into an application written in C and use it as an extension or command language for that application.

By the way, the language is named after the BBC show “Monty Python’s Flying Circus” and has nothing to do with reptiles. Making references to Monty Python skits in documentation is not only allowed, it is encouraged!

Now that you are all excited about Python, you’ll want to examine it in some more detail. Since the best way to learn a language is to use it, the tutorial invites you to play with the Python interpreter as you read.

In the next chapter, the mechanics of using the interpreter are explained. This is rather mundane information, but essential for trying out the examples shown later.

The rest of the tutorial introduces various features of the Python language and system through examples, beginning with simple expressions, statements and data types, through functions and modules, and finally touching upon advanced concepts like exceptions and user-defined classes.

【读英文文档】Whetting Your Appetite(刺激你的食欲)的更多相关文章

  1. 教你阅读MSDN英文文档,迅速提升编程能力

    在教大家阅读英文文档之前,首先给大家明确一个概念.C#和.NET的区别? 有一定编程经验的同学应该多多少少知道这方面的概念,但是可能模糊,理解的不一定深刻.我在这里简单给出两者的基本定义: C#:仅仅 ...

  2. openstack【Kilo】汇总:包括20英文文档、各个组件新增功能及Kilo版部署

    OpenStack Kilo版本发布 20英文文档OpenStack Kilo版本文档汇总:各个操作系统安装部署.配置文档.用户指南等文档 Kilo版部署 openstack[Kilo]入门 [准备篇 ...

  3. py爬取英文文档学习单词

    最近开始看一些整本整本的英文典籍,虽然能看个大概,但是作为四级都没过的我来说还是有些吃力,总还有一部分很关键的单词影响我对句子的理解,因为看的是纸质的,所以查询也很不方便,于是想来个突击,我想把程序单 ...

  4. 英文文档帮查&翻译计划

    以CSDN为首,知乎其次,cnblog带路的一大批博客上充斥着大量低质量的编程入门教程,代码粗制滥造,毫无缩进,没有高亮,东抄西抄.初学者如果长期参照这种垃圾博客来解决问题,将会适得其反,走入歧途. ...

  5. Python3求英文文档中每个单词出现的次数并排序

    [本文出自天外归云的博客园] 题目要求: 1.统计英文文档中每个单词出现的次数. 2.统计结果先按次数降序排序,再按单词首字母降序排序. 3.需要考虑大文件的读取. 我的解法如下: import ch ...

  6. gitlab安装教程、gitlab官网、英文文档

    gitlab官网 https://about.gitlab.com/ gitlab安装和官网英文文档 https://about.gitlab.com/downloads/ 清华大学tuna镜像源 G ...

  7. Android 英文文档下载地址

    通过英文Android API学习Android技术是一个不错选择,当然养鸡的专业户要小心了,以下分享一些下载英文文档的链接(请使用迅雷下载): https://dl-ssl.google.com/a ...

  8. PHP-redis英文文档

    作为程序员,看英文文档是必备技能,所以尽量还是多看英文版的^^ PhpRedis The phpredis extension provides an API for communicating wi ...

  9. python3 怎么统计英文文档常用词?(附解释)

    # coding: utf-8 # In[32]: #import requests #from bs4 import BeautifulSoup #res = requests.get(" ...

随机推荐

  1. ZooKeeper实现分布式锁

    使用场景          一般的锁是指单进程多线程的锁,在多线程并发编程中,用于线程之间的数据同步,保证共享资源的访问.而分布式锁,指的是在分布式环境下,保证跨进程.跨主机.跨网络的共享资源,实现互 ...

  2. Linux Shell 命令--awk

    说明: awk被设计用于数据流,能够对列和行进行操作.而sed更多的是匹配,进行替换和删除.awk有很多内建的功能,比如数组,函数等.灵活性是awk的最大优势.  awk的结构}{i++}END{pr ...

  3. Ubuntu 14 安装WPS

    在32位Ubuntu 14.04 安装 WPS,WPS For Linux版除延续Windows版相同体验外,更加尊重Linux用户特定的使用习惯:深度兼容:自带方正字体集:在线模板和素材使文档创作更 ...

  4. 怎样写一个与Win8 IE11兼容的标准BHO?

    怎样写一个与Win8 IE11兼容的标准BHO? 环境:Windows8.1 x86 IE11(其它环境未讨论) 作者:magictong 日期:2014/02/02 概述 微软在2013年6月份推出 ...

  5. LeetCode之“链表”:Sort List

    题目链接 题目要求: Sort a linked list in O(n log n) time using constant space complexity. 满足O(n log n)时间复杂度的 ...

  6. 嵌入式C语言位运算之清位置位

    如题,在嵌入式开发中,掌握位运算是节省开发时间和提高开发效率的一种高效方式. 我们不得不去熟悉如何快速掌握位运算这种高效的技巧,接下来看看程序.. #include <stdio.h> # ...

  7. JFinal开发环境搭建,JFinal开发案例

     JFinal  是基于 Java  语言的极速  WEB  + ORM  开发框架,其核心设计目标是开发迅速.代码量少.学习简单.功能强大.轻量级.易扩展.Restful.在拥有Java 语言所 ...

  8. Android热补丁技术—dexposed原理简析(手机淘宝采用方案)

    上篇文章<Android无线开发的几种常用技术>我们介绍了几种android移动应用开发中的常用技术,其中的热补丁正在被越来越多的开发团队所使用,它涉及到dalvik虚拟机和android ...

  9. HBase Muti-Master

    为了保证HBase集群的高可靠性,HBase支持多Backup Master 设置.当Active Master挂掉后,Backup Master可以自动接管整个HBase的集群. 该配置极其简单: ...

  10. Linux input子系统分析

    输入输出是用户和产品交互的手段,因此输入驱动开发在Linux驱动开发中很常见.同时,input子系统的分层架构思想在Linux驱动设计中极具代表性和先进性,因此对Linux input子系统进行深入分 ...