python实现的守护进程(Daemon)def createDaemon(): ”’Funzione che crea un demone per eseguire un determinato programma…”’ import os # create - fork 1 try: ……继续阅读 » 水墨上仙 8年前 (2018-01-09) 3342浏览 2049个赞
Perl批量执行Linux安装程序和脚本#!/usr/bin/perl#use Cwd;sub ExecuteAll(){ local($dir) = @_; opendir(DIR,"$dir"|| die "can't open $dir"); local @files =rea……继续阅读 » 水墨上仙 8年前 (2018-01-09) 2925浏览 1932个赞
python提取url中的域名和端口号import urllib proto, rest = urllib.splittype("http://www.75271.com/11/12.htm") host, rest = urllib.splithost(rest) print host host, port =……继续阅读 » 水墨上仙 8年前 (2018-01-09) 2046浏览 2779个赞
来源:http://blog.csdn.net/sun7545526/article/details/8138603需求:设计一个”石头,剪子,布”游戏,有时又叫”Rochambeau”,你小时候可能玩过,下面是规则.你和你的对手,在同一时间做出特定的手势,必须是下面一种手势:石头,剪子,布.胜利者从下面的……继续阅读 » 水墨上仙 8年前 (2018-01-09) 3179浏览 2121个赞
python检查一个集合是否包含了另外一个集合的所有项>>> L1 = [1, 2, 3, 3]>>> L2 = [1, 2, 3, 4]>>> set(L1).difference(L2)set([ ])>>> set(L2).difference(L1)set(……继续阅读 » 水墨上仙 8年前 (2018-01-09) 3511浏览 1492个赞
python字符串按单词反转输出方法1import reastring = 'hello world'revwords = ' '.join(reversed(astring.split()))print(revwords)方法2import reastring = 'hello ……继续阅读 » 水墨上仙 8年前 (2018-01-09) 2006浏览 486个赞
python通过正则获取网页上的全部链接import re, urllibhtmlSource = urllib.urlopen("http://www.75271.com").read(200000)linksList = re.findall('<a href="(.*?)">.*?……继续阅读 » 水墨上仙 8年前 (2018-01-09) 1470浏览 2611个赞
微擎 负载均衡搭建微擎已经积累了很多大型用户,特别是用户在做红包、现场摇一摇等大并发的活动时,对程序的性能和负载处理能力要求很高,所以对程序性能的优化和提供大并发时负载均衡部署的解决方案是微擎0.7的重中之重。在微擎0.7的系统菜单中很明显就能看到性能优化的配置页,点进去我们能看到下面三条说明:1、首先定下是用谁的负载均衡服务器?阿里、腾讯、百度、亚马……继续阅读 » 开心洋葱 8年前 (2018-01-09) 2770浏览 0评论2367个赞
python plt.show 关闭在用python中的matplotlib 画图时,show()函数总是要放在最后,且它阻止命令继续往下运行,直到1.0.1版本才支持多个show()的使用。想在显示图像后继续运行相关的处理命令,或者显示一副图像后关闭它,再显示第二幅图像。如下办法:plt.close() will close current inst……继续阅读 » 开心洋葱 8年前 (2018-01-09) 2322浏览 0评论2657个赞
程序会监听8080端口,然后简单的返回web/路径下的文件,假如只输入类似localhost:8080,会自动找到index.htmlpackage mainimport ( "net/http")func main() { http.Handle("/", http.FileServ……继续阅读 » 水墨上仙 8年前 (2018-01-09) 2153浏览 2667个赞
Python获取CPU使用率、内存使用率、网络使用状态注:需要安装psutil库#!/usr/bin/env python## $Id: iotop.py 1160 2011-10-14 18:50:36Z g.rodola@gmail.com $## Copyright (c) 2009, Jay Loden, Giampaolo Ro……继续阅读 » 水墨上仙 8年前 (2018-01-08) 2778浏览 107个赞