导航

随笔分类 -  IT Skill

摘要:https://mirrors.fedoraproject.org/publiclist/http://mirror.centos.org/centos/6.3/os/i386/http://rpmfind.netrpm listhttp://pkgs.org/http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpmrpm -Uvh epel-release*rpmwine 安装X针对错误checking for X... noconfigure: error: X development files not 阅读全文

posted @ 2013-06-12 22:18 疯狂原始人 阅读(182) 评论(0) 推荐(0)

摘要:Debian安装flashplaer: 1.修改/etc/apt/sources.listdeb http://ftp.de.debian.org/debian squeeze main contribapt-get updateapt-get install flashplugin-nonfree or aptitude reinstall flashplugin-nonfreeCentos安装flashplaer: 1.Install Adobe YUM Repository RPM package## Adobe Repository 32-bit x86 ##rpm -ivh ht.. 阅读全文

posted @ 2013-06-12 22:16 疯狂原始人 阅读(255) 评论(0) 推荐(0)

摘要:Debian开机启动VNC:启动VNC并设置:startjwm & firefox --display=:1### BEGIN INIT INFO# Provides: vncserver# Required-Start: $remote_fs $syslog# Required-Stop: $remote_fs $syslog# Default-Start: 2 3 4 5# Default-Stop: 0 1 6# Short-Description: Start daemon at boot time# Description: Enable service provided b 阅读全文

posted @ 2013-06-12 22:15 疯狂原始人 阅读(1923) 评论(0) 推荐(0)

摘要:1 源文件编码 在文件头部使用coding声明。告诉python 解释器该代码文件所使用的字符集。 #/usr/bin/python #coding: utf82 内部编码 代码文件中的字符串,经过decode以后,被转换为统一的unicode格式的内部数据,类似于u'*'。unicode数据可以使用encode函数,再自由转换为其他格式的数据,相当于一个统一的平台。 直接输入unicode数据 >>> u'你好' u'\u4f60\u597d' 将unicode数据转换为 gb2312 格式 >>> u 阅读全文

posted @ 2013-06-12 22:04 疯狂原始人 阅读(593) 评论(0) 推荐(0)

摘要:urllib和urllib2都是接受URL请求的相关模块,但是提供了不同的功能。两个最显著的不同如下:urllib2 can accept a Request object to set the headers for a URL request, urllib accepts only a URL. That means, you cannot masquerade your User Agent string etc.urllib2可以接受一个Request类的实例来设置URL请求的headers,urllib仅可以接受URL。这意味着,你不可以伪装你的User Agent字符串等。url 阅读全文

posted @ 2013-06-12 22:01 疯狂原始人 阅读(307) 评论(0) 推荐(0)

摘要:据库的基本导入\导出的命令 是 mysqldump 和 source 在linux下直接用命令行操作就可以 在windows下 一般情况下有两种方法一个也是用命令行 另一个是用phpmyadmin 先来说说phpmyadmin 这个工具导出和导入很简单 而且导入时无需建库 直接还原成原来的数据库 用source 也可以还原 但他导入文件时有大小限制不能超过2M再来说说 mysqldump 和 source 用命令操作很快 但是想把导出的文件再导入时必须先建立一个数据库(这个库可以随便起名) 然后进入数据库后才能导入用phpmyadmin导入mysqldump 导出的文件也得需要这步 下面是从前 阅读全文

posted @ 2013-06-12 21:49 疯狂原始人 阅读(177) 评论(0) 推荐(0)

摘要:Python正则表达式在使用中会经常应用到字符串替换的代码。有很多人都不知道如何解决这个问题,下面的代码就告诉你其实这个问题无比的简单,希望你有所收获。1.替换所有匹配的子串用newstring替换subject中所有与正则表达式regex匹配的子串result, number = re .subn(regex, newstring, subject)2.替换所有匹配的子串(使用正则表达式对象)rereobj = re.compile(regex)result, number = reobj.subn(newstring, subject)字符串拆分Python字符串拆分re result.. 阅读全文

posted @ 2013-06-12 21:41 疯狂原始人 阅读(18150) 评论(0) 推荐(1)

摘要:import rere.compile(r'^(http(s)?://)?([\w-]+\.)+[\w-]+/?')正则式()表示(exp) 匹配exp,并捕获文本到自动命名的组里所以当url='http://www.360buy.com/product/755411.html'print p.search(url).group(0) -> http://www.360buy.com/print p.search(url).group(1) -> http://print p.search(url).group(2) -> Noneprint 阅读全文

posted @ 2013-06-12 21:27 疯狂原始人 阅读(1162) 评论(0) 推荐(0)