1.首先将settings设置debug=false。2.STATICFILES_DIRS = ( 'static', os.path.join(os.path.dirname(__file__), '..', 'static'), # Put strings here, like "/home/h...
分类:
其他好文 时间:
2014-07-21 14:33:09
阅读次数:
189
前一篇博文提到怎么得到汉字字库,这篇文章讲怎么把一个一个的字转成图片,这在机器学习中会有用处。
一句话,用pygame渲染文字到图片上。
下面上代码。
import os
import pygame
chinese_dir = 'chinese'
if not os.path.exists(chinese_dir):
os.mkdir(chinese_dir)
pygame.ini...
分类:
编程语言 时间:
2014-07-20 11:43:38
阅读次数:
334
nagios配置文件生成htpasswd/etc/nagios/passwdnagiosadminidentity资产唯一编号chmod444/etc/assetid接口要写的健壮接口判断值是否全面批量的生成ip,主机名,其它项都一致pipinstall‘ipython<2.0‘CURR_DIR=os.path.abspath(os.path.dirname(__file__))当前这个文件名所在..
分类:
移动开发 时间:
2014-07-17 08:14:03
阅读次数:
323
os和os.path模块os.listdir(dirname):列出dirname下的目录和文件os.getcwd():获得当前工作目录os.curdir:返回但前目录('.')os.chdir(dirname):改变工作目录到dirnameos.remove(file):删除文件os.path.i...
分类:
编程语言 时间:
2014-07-11 10:50:08
阅读次数:
228
在命令行敲一串长的命令,枯燥麻烦。
#coding:utf-8
import sys
import os
import subprocess
if len(sys.argv) == 2:
#节省输入,不输入后缀
#直接使用参数的第2个值
file = sys.argv[1] + '.ui'
#检查输入文件是否存在
if not os.path.e...
分类:
其他好文 时间:
2014-07-10 20:17:25
阅读次数:
157
00编写一个程序,统计当前目录下每个文件类型的文件数import osall_files = os.listdir(os.curdir)type_dict =dict()for each_file in all_files: if os.path.isdir(each_file): ...
分类:
其他好文 时间:
2014-07-09 18:46:33
阅读次数:
215
settings里的设置PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname('__file__')))MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'media')MEDIA_URL = '/med...
分类:
其他好文 时间:
2014-07-09 17:55:20
阅读次数:
1986
#coding=utf-8import osimport hashlibdef GetFileMd5(filename): if not os.path.isfile(filename): print(filename) return mymd5 = has...
分类:
其他好文 时间:
2014-07-08 23:52:38
阅读次数:
502
直接上代码吧#-*-coding:utf-8import osif os.path.exists('d:\\cpickle.data'): os.remove('d:\\cpickle.data')import cPickle as Pshoplist=['apple','banana','...
分类:
编程语言 时间:
2014-07-07 00:09:58
阅读次数:
475
标准库:一些最爱
os
os模块为你提供了访问多个操作系统服务的功能。
os和它的子模块os.path还包括一些用于检查、构造、删除目录和文件的函数,以及一些处理路径的函数。
os模块中一些重要函数和变量
函数/变量
描述
environ
对环境变量进行映射
system(command)
在子s...
分类:
编程语言 时间:
2014-07-06 00:30:46
阅读次数:
311