Python3.3.2入门教程.pdf
本文适合有经验的程序员尽快进入PythonS界。特别是如果你掌握了Java和Javascript,你可以在不到1小时的时间内用Python快速流畅地编写有用的Python程序。-为什么要使用 Python?
假设我们有这样一个任务:简单测试局域网中的计算机是否连接。这些计算机的 ip 范围是从 192.168.0.101 到 192.168.0.200。
想法:使用shell编程。 (Linux 通常是 bash,Windows 是批处理脚本)。比如在 Windows 上,使用 ping ip 命令依次测试每台机器,得到控制台输出。由于控制台文本通常是“”来自...的回复当文本为“timeout ...”时未连接,因此,您可以通过在结果中执行字符串搜索来确定机器是否连接。
(This article is suitable for experienced programmers to enter the python world as soon as possible. Especially if you master Java and JavaScript, you can write useful Python programs quickly and smoothly in Python in less than an hour-
Why use Python?
Suppose we have such a task: simply test whether the computers in the LAN are connected. The IP range of these computers is 192.168.0.101 to 192.168.0.200.
Idea: use shell programming. (Linux is usually bash, and windows is a batch script). For example, on windows, use the Ping IP command to test each machine in turn and get the console output. Because console text is usually "" from When the text is "timeout..." Is not connected, so you can determine whether the machine is connected by performing a string search in the results.)
页:
[1]