1. 模块 在python中一个文件可以被看成一个独立模块,而包对应着文件夹,模块把python代码分成一些有组织的代码段,通过导入的方式实现代码重用。1.1 模块搜索路径 导入模块时,是按照sys.path变量的值搜索模块,sys.path的值是包含每一个独立路径的列表,包含当前目录、pyth.....
分类:
编程语言 时间:
2015-07-22 12:13:20
阅读次数:
153
#实现目录递归遍历,查找.log文件,并将结果存入文件importos
res=[]
deffindfile(dir):
foriinos.listdir(dir):
ifos.path.isdir(dir+os.sep+i)==True:
findfile(dir+os.sep+i)
else:
ifi[-4:]==‘.log‘:
res.append(dir+os.sep+i)
findfile(os.path.abspath(‘.‘))
#findfile(‘..
分类:
编程语言 时间:
2015-07-22 11:05:16
阅读次数:
215
Problem Definition:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equa...
分类:
其他好文 时间:
2015-07-21 21:55:17
阅读次数:
105
The minimal path sum in the 5 by 5 matrix below, by starting in any cell in the left column and finishing in any cell in the right column, and only moving up, down, and right, is
indicated in red an...
分类:
其他好文 时间:
2015-07-21 17:10:05
阅读次数:
145
SSH返回JSON格式的数据时,需要用到gson,将gson-1.6.jar添加进Build path以后运行,出错:后来把gson-1.6.jar复制到WEB-INF/lib/下再运行,就没再出这个错误了。原来即使加入了Build path也还是要复制到WEB-INF/lib/下,但是其他的jar...
分类:
编程语言 时间:
2015-07-21 16:34:20
阅读次数:
149
第三方函数库下载地址:https://pypi.python.org/pypi/httplib2/2、解压下载的压缩包“httplib2-0.9.1.zip”到某目录下3、配置python在dos下的运行环境(之前需要配置系统环境变量,在系统环境变量Path后添加python安装目录,例如d:/python)4、dos下安装httpLib2模块5、解压ht..
分类:
编程语言 时间:
2015-07-21 15:25:57
阅读次数:
372
softlink又叫做symboliclink,相当于一种”快捷方式”,由ln–ssourcefiledistinctionfile(ln–sTARGETLINK_NAME)创建,连接文件的存在使得简化了文件系统,用户操作起来更加方便。但在Shell编程中却是一个需要非常注意的点,因为工作目录(WorkDirectory)的原因,Shell需要..
分类:
系统相关 时间:
2015-07-21 15:15:58
阅读次数:
124
题目:
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.
For example:
Given the below binary tree...
分类:
编程语言 时间:
2015-07-21 12:59:51
阅读次数:
120
题目:
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/...
分类:
编程语言 时间:
2015-07-21 12:54:55
阅读次数:
127
1.向服务器请求返回图片,浏览器是不知道服务上有这个图片的存在的,只是发出请求,接收请求,显示图片string path = context.Server.MapPath("~/1.jpg");//获取服务器上的图片并转换为本地路径//显示到输出流中using (Stream instream = ...
分类:
Web程序 时间:
2015-07-21 12:37:11
阅读次数:
142