随笔分类 -  python

摘要:'''新建一项目'''1.django-admin.py startproject name2.django-admin.py startapp name'''同步数据库登录admin没有表:需在admin.py注册'''3.python manage.py syncdb'''django1.6.2... 阅读全文
posted @ 2014-04-23 21:09 yuluhuang 阅读(1166) 评论(0) 推荐(0)
摘要:sudo rm /usr/bin/pythonsudo ln -s /usr/local/bin/python3.4 /usr/bin/python 阅读全文
posted @ 2014-04-21 19:55 yuluhuang 阅读(160) 评论(0) 推荐(0)
摘要:python Django1.xcode2.python3.pip 1)download get-pip.py 2)python get-pip.py4.Django pip install Django==1.6.2(可自己下载安装)5.mysql https://www.akii.org/mac-os-x-install-mysql-dm.html6.mysqldb(pip install mysql-python 失败自行下载安装包) 1)修改(路径根据本机自己设定) site.cfg mysql_config = /usr/local/mysql/bin/mysql_c... 阅读全文
posted @ 2014-04-12 15:42 yuluhuang 阅读(186) 评论(0) 推荐(0)
摘要:1.选定源码目录可以是任何目录,本文选定的是/usr/local/srccd /usr/local/src2.安装PCRE库ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/下载最新的 PCRE 源码包,使用下面命令下载编译和安装 PCRE 包:cd /usr/local/srcwgetftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.32.tar.gztar-zxvf pcre-8.32.tar.gzcdpcre-8.32./configuremakemakei. 阅读全文
posted @ 2013-12-21 13:55 yuluhuang 阅读(217) 评论(0) 推荐(0)
摘要:mysql>SETcharacter_set_client=utf8;mysql>SETcharacter_set_connection=utf8;mysql>SETcharacter_set_database=utf8;mysql>SETcharacter_set_results=utf8;mysql>SETcharacter_set_server=utf8;mysql>SETcollation_connection=utf8;mysql>SETcollation_database=utf8;mysql>SETcollation_server= 阅读全文
posted @ 2013-11-14 15:04 yuluhuang 阅读(96) 评论(0) 推荐(0)
摘要:encode 编码,以不同方式编码为bytes .encode('utf-8')decode 解码 .decode('utf-8') 阅读全文
posted @ 2013-11-05 12:40 yuluhuang 阅读(125) 评论(0) 推荐(0)
摘要:Ctrl-Z不是结束进程,而是挂起进程,也就是让它暂时休眠。在 shell 下,使用fg可以把该进程(组)放到前台接着跑,使用bg来让其在后台接着跑。要中止一个进程,请使用Ctrl-C。sudo netstat -tulpn | grep :端口号命令查出端口被哪个进程占用了 然后用kill -9 [PID]也可以用这个命令查出某端口被哪个程序占用了:$ lsof -i:端口号$ kill -9 [PID] 阅读全文
posted @ 2013-11-05 10:29 yuluhuang 阅读(136) 评论(0) 推荐(0)
摘要:http://www.starming.com/index.php?action=plugin&v=wave&tpl=union&ac=viewgrouppost&gid=73&tid=17981martch和search的区别Python提供了两种不同的原始操作:match和search。match是从字符串的起点开始做匹配,而search(perl默认)是从字符串做任意匹配 正则表达式是' ^ '开头时,match与search是相同的。match只有当且仅当被匹配的字符串开头就能匹配或从pos参数的位置开始就能匹配时才会成功re.s 阅读全文
posted @ 2013-10-23 09:34 yuluhuang 阅读(143) 评论(0) 推荐(0)
摘要:>>>squared = [x**2 for x in range(4)]>>>for i in squared:... print i0149>>>sqdEvens=[x**2 for x in range(8) if not x%2]try:filename=raw_input('Enter file name:')fobj=open(filename,'r')for eachLine in fobj:print eachLine,fobj.close()except IOError, e:print & 阅读全文
posted @ 2013-10-02 21:16 yuluhuang 阅读(171) 评论(0) 推荐(0)