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

如果你是一个专业的软件开发者,你要使用诸如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. android TabLayout实现京东详情效果

    Google在2015的IO大会上,给我们带来了更加详细的Material Design设计规范,同时,也给我们带来了全新的Android Design Support Library,在这个supp ...

  2. (NO.00001)iOS游戏SpeedBoy Lite成形记(十九)

    最后就是要完成前面设定的第3件事:如果玩家赌对了则赢钱,反之输钱. 前面的框架搭的差不多了,所以这里实现起来也就不难了 ;) 首先我们怎么知道用户输入完毕,然后关闭窗口了?只有在这个点上GameSce ...

  3. (二十六)静态单元格(Cell)

    制作类似iOS系统设置的页面,如果使用代码来实现,将会比较麻烦,可以通过静态单元格技术方便的实现. 注意:静态单元格只支持TableViewController. 可以通过storyboard直接操作 ...

  4. 【翻译】Siesta事件记录器入门

    原文:Getting started with the Siesta event recorder 作者:Mats Bryntse 随着事件记录器功能的发布越来越近,我们准备了一下入门指南,向大家展示 ...

  5. Github 错误合集:Failed connect to github.com:8080 || Failed connect to github.com:443; No error

    文/skay 地址:http://blog.csdn.net/sk719887916/article/details/40541199 开发中遇到github无法pull和push代码问题,原来git ...

  6. Android Data Binding代码实践(告别findViewById)(四)

    Data Binding实战(一) Data Binding语法解析(二) Data Binding高级用法(三) 好了,继前三篇学习了Data Binding之后,我们可以发现它的强大之处有这么几点 ...

  7. MR PAGERANK思路

    map( key: [url, pagerank], value: outlink_list ) for each outlink in outlink_list emit( key: outlink ...

  8. 关于Html5发展和应用前景

    现在的HTML5就像当年崭露头角时的Ajax,有人在做,但不知道叫它什么.最近,苹果在 HTML5上大做文章,而著名的Web设计师Eric Meyer则提出了Web Stacks的概念.Alex Ke ...

  9. linux下由带-开头文件想到的

    如果要删除文件-aaa,使用rm -aaa是不行的,rm会认为-后面的是参数.2种办法: 1 带明确路径指示 rm ./-aaa 2 使用 -- :rm -- -aaa 因为命令如果发现参数中有--, ...

  10. unix命令自我总结

    三种参数类型 1⃣时间日期: cal times time 2⃣文字处理: ctl+v 输入控制字符 ${#str} str字符串长度 expr length $abc 同上 typeset -i x ...