上一页 1 ··· 6 7 8 9 10 11 下一页

2016年1月13日

Python 协程

摘要: def GenerateProcess(): filelocal = r'c:\Te' for i in range(10): baiWei = i * 100 filename = [None] * 100 filelocalation = [... 阅读全文

posted @ 2016-01-13 20:44 小作一个 阅读(205) 评论(0) 推荐(0)

2016年1月12日

Python 用多线程上传和下载文件

摘要: 1 # -*- coding: utf-8 -*- 2 __author__ = 'louis' 3 4 from ftplib import FTP 5 import multiprocessing 6 import time 7 8 9 def ftpconnect():10 f... 阅读全文

posted @ 2016-01-12 21:17 小作一个 阅读(5626) 评论(1) 推荐(0)

2016年1月9日

Python 变量交换

摘要: 1 # coding = utf-8 2 3 a, b = 1, 2 4 print 'before change' 5 print a, b 6 7 a, b = b, a 8 print 'after change' 9 print a, b 10 11 #>>> 12 #befor... 阅读全文

posted @ 2016-01-09 22:21 小作一个 阅读(423) 评论(0) 推荐(0)

2016年1月8日

Python 将文件重新命名

摘要: 1 # -*- coding: utf-8 -*- 2 __author__ = 'louis' 3 4 import os 5 import re 6 7 8 def rename_files(dir_path): 9 i=110 print dir_path11 ... 阅读全文

posted @ 2016-01-08 22:20 小作一个 阅读(860) 评论(0) 推荐(0)

Python ftplib模块

摘要: # -*- coding: utf-8 -*-__author__ = 'louis'from ftplib import FTPftp = FTP()timeout = 30port = 22ftp.connect('ip',port,timeout) # 连接FTP服务器ftp.login('u... 阅读全文

posted @ 2016-01-08 17:43 小作一个 阅读(464) 评论(0) 推荐(0)

2016年1月6日

Python ftplib模块

摘要: Help on module ftplib:NAME ftplib - An FTP client class and some helper functions. 名字:ftplib 模块 - 一个FTP客户端类 和 一些辅助的方法 FILE c:\python27\lib\ftpli... 阅读全文

posted @ 2016-01-06 20:46 小作一个 阅读(4152) 评论(0) 推荐(0)

2016年1月4日

Python 函数作为返回值

摘要: 函数作为返回值高阶函数除了可以接收函数作为参数外,还可以把函数作为结果值返回。def lazy_sum(*args): def sum(): ax=0 for n in args: ax = ax + n return ax r... 阅读全文

posted @ 2016-01-04 16:59 小作一个 阅读(29181) 评论(0) 推荐(0)

Python map/reduce/filter/sorted函数以及匿名函数

摘要: 1. map() 函数的功能:map(f, [x1,x2,x3]) = [f(x1), f(x2), f(x3)]def f(x):return x*xa = map(f, [1, 2, 3, 4, 5])b = map(f, (6, 7, 8, 9))print aprint b# [1, 4, ... 阅读全文

posted @ 2016-01-04 10:44 小作一个 阅读(839) 评论(0) 推荐(0)

2016年1月1日

Python 高阶函数

摘要: 1. 变量可以指向函数名def f(a): return abs(a)h = f(-10) # 这样是调用函数f且把结果传给变量hprint hh = f # 这是让变量h指向函数f.print h(-10)2. 函数名也是变量def f(a): return abs(a)f = 1f(-10)... 阅读全文

posted @ 2016-01-01 17:36 小作一个 阅读(228) 评论(0) 推荐(0)

Python 列表生成器

摘要: 1. 列表里生成器相比range()生成的列表生成一个列表[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]可用range(1,11)L = range(1,11)# print L# [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]如果要生成一个[1x1, 2x2, 3x... 阅读全文

posted @ 2016-01-01 17:01 小作一个 阅读(299) 评论(0) 推荐(0)

上一页 1 ··· 6 7 8 9 10 11 下一页

导航