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

如果你是一个专业的软件开发者,你要使用诸如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. javascript语法之with语句

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  2. Git版本控制:Git冲突解决 相关错误总结

    http://blog.csdn.net/pipisorry/article/details/46958699 冲突处理 git push冲突处理 git push时出现冲突:! [rejected] ...

  3. 【公开课】【阿里在线技术峰会】何登成:AliSQL性能优化与功能突破的演进之路

    MySQL的公开课,可能目前用不上这些,但是往往能在以后想解决方案的时候帮助到我.以下是阿里对公开课的整理 摘要: 本文根据阿里高级数据库专家何登成在首届阿里巴巴在线技术峰会上的分享整理而成.他主要介 ...

  4. AndFix使用感想

    AndFix已经使用了一段时间了,但是到AndFix上看了一下,最近2个月都没有更新代码了,有141个issues和3个pull request没人处理,其实AndFix的Contributors就俩 ...

  5. Linux下C语言的调试 - gdb

    调试是每个程序员都会面临的问题. 如何提高程序员的调试效率, 更好更快地定位程序中的问题从而加快程序开发的进度, 是大家共同面对的问题. 可能Windows用户顺口就会说出:用VC呗 :-) , 它提 ...

  6. 中国象棋游戏Chess(2) - 走棋

    之前的文章请看:中国象棋游戏Chess(1) - 棋盘绘制以及棋子的绘制 现在实现走棋的功能. 首先需要获取点击到的棋子,用QWidget中的函数 mouseReleaseEvent 实现函数: vo ...

  7. 【1】mac下面iTerm配置oh-my-zsh教程

    1.安装iterm 地址如下: http://iterm2.com/ 2.安装oh-my-zsh 打开iterm输入如下命令: sh -c "$(curl -fsSL https://raw ...

  8. Gradle 1.12用户指南翻译——第三十四章. JaCoCo 插件

    本文由CSDN博客万一博主翻译,其他章节的翻译请参见: http://blog.csdn.net/column/details/gradle-translation.html 翻译项目请关注Githu ...

  9. Hbase replication操作

    1.修改hbase-site.xml文件 <property>  <name>hbase.replication</name>  <value>true ...

  10. Oracle :%TYPE 和 %ROWTYPE

    1. 使用%TYPE 在许多情况下,PL/SQL变量可以用来存储在数据库表中的数据.在这种情况下,变量应该拥有与表列相同的类型.例如,students表的first_name列的类型为VARCHAR2 ...