== 13.1. "Tune In, Log On, and Drop Out" 收听,登入和脱离 (ShenXiaoFeng翻译中)== Over the last decade, the Internet has virtually exploded onto the mainstream stage. It has rapidly grown from a simple communication device used primarily by academics and researchers into a medium that is now nearly as pervasive as the television and telephone. Social observers have likened the Internet's cultural impact to that of the printing press, and technical observers have suggested that all new software development of interest occurs only on the Internet. Naturally, time will be the final arbiter for such claims, but there is little doubt that the Internet is a major force in society, and one of the main application contexts for modern software systems.
在过去十几年,因特网技术事实上已经发展成主流技术。它的快速发展,使这种本来是大专院校里,研究者之间一种简单的交流设备,现在变成广泛的信息交流媒介,在电视机与电话机之间也可交流信息。社会学者把因特网文化影响的重要性比作当年印刷机的出现。技术学者还认为以后的软件发展应该建基于因特网。一些相关的言论,最后将随着时间得出结论,但不用置疑的是,因特网已经成为影响社会的重要力量,也是现代计算机软件系统的一个主要应用领域。
The Internet also happens to be one of the primary application domains for the Python programming language. It has been a decade since the first edition of this book was written as well, and in that time the Internet's growth has strongly influenced Python's tool set and roles. Given Python and a computer with a socket-based Internet connection today, we can write Python scripts to read and send email around the world, fetch web pages from remote sites, transfer files by FTP, program interactive web sites, parse HTML and XML files, and much more, simply by using the Internet modules that ship with Python as standard tools.
Python编程语言的一个重要的应用领域就是因特网。这本书的第一版书写到现在的十年间,因特网飞速发展,影响着Python语言的工具集的发展和Python的角色变化。给我们一台连着网络的计算机与Python编程环境,我们就能写着Python脚本来收发电邮,从远程的服务器抓取网页,用FTP传输文件,做交互式的网站,分析HTML和XML文件。做这么多的工作,其实就是简单地利用了Python的Internet modules(因特网模块)。
In fact, companies all over the world do: Google, Yahoo!, Walt Disney, Hewlett-Packard, JPL, and many others rely on Python's standard tools to power their web sites. For example, the Google search enginewidely credited with making the web usablemakes extensive use of Python code. And the BitTorrent peer-to-peer file transfer systemwritten in Python and already downloaded by tens of millions of usersleverages Python's networking skills to share files among clients and remove server bottlenecks.
Many also build and manage their sites with the Zope web application server, which is itself written and customizable in Python. Others build sites with the Plone content management system, which is built upon Zope and delegates site content to its users. Still others use Python to script Java web applications with Jython (formerly known as JPython)a system that compiles Python programs to Java bytecode, exports Java libraries for use in Python scripts, and allows Python code to serve as web applets downloaded and run in a browser.
More recently, XML-RPC and SOAP interfaces for Python, such as xmlrpclib and SOAPy, have enabled web service programming; frameworks such as CherryPy, Webware, TurboGears, and Django have emerged as convenient tools for constructing web sites; the new XML package in Python's standard library provides a suite of XML processing tools; and the new IronPython implementation promises to provide seamless .NET/Mono integration for Python code.
As the Internet has grown, so too has Python's role as an Internet tool. Python has proven to be well suited to Internet scripting for some of the very same reasons that make it ideal in other domains. Its modular design and rapid turnaround mix well with the intense demands of Internet development. In this part of the book, we'll find that Python does more than simply support Internet scripts; it also fosters qualities such as productivity and maintainability that are essential to Internet projects of all shapes and sizes.
13.1.1. Internet Scripting Topics
Internet programming entails many topics, so to make the presentation easier to digest, I've split this subject over the next six chapters of this book. This chapter introduces Internet fundamentals and explores sockets, the underlying communications mechanism of the Internet. From there, later chapters move on to discuss the client, the server, web site construction, and more advanced topics.
Each chapter assumes you've read the previous one, but you can generally skip around, especially if you have any experience in the Internet domain. Since these chapters represent a substantial portion of this book at large, the following sections go into a few more details about what we'll be studying.
章标题1
小节标题1
1 Python code
反馈
创建 by @ShenXiaoFeng@ [@20081107@]
[:PP3eD/Ch-13-1/PageCommentData:PageCommentData]' |