最简单的 python 多线程示例
import time,thread
def test(a,b):
for i in range(a,b):
time.sleep(1)
print i
def start():
thread.start_new_thread(test,(1,1001))
thread.start_new_thread(test,(1000,2001))
if __name__=='__main__':
start()
相关文档:
首先下载最新版本的Python,在这里我的版本是Python3.1.1。然后就是安装,切换到Python的文件目录下:
./configure
make
make test
sudo make install
在这里可能会遇到几个问题,第一个是在./configure时,可能会出现C compiler cannot create ......
#! /usr/bin/env python
# -*- coding: utf-8 -*-
from ftplib import FTP
from os import path
from optparse import OptionParser
from FtpDownload import spilt_cmd
import socket
import sys
'''
上传终端MR文件到服务器
V1.0 zhai 2009-07-27
'''
def main():
&nbs ......
from: http://www.cnblogs.com/dahuzizyd/archive/2005/03/01/111006.html
python支持面向对象的编程风格,这里主要说说python中的多继承:
下面的代码使用python2.4,安装后使用idle的IDE开发环境(说是IDE ,比起delphi,VS.net等简单得太多了)
从File-New菜单建立一个.py文件,写下面的代码:
class SuperCl ......