### 首先登陆mysql shell$ mysql -u root -h 127.0.0.1 -p$密码输入### 查看mysql中现在执行的 所有线程mysql>show processlist; 线程id 登陆用户 主机 ……继续阅读 » 开心洋葱 5年前 (2020-11-16) 2781浏览 0评论2613个赞
Python遍历字符串中的每一个字符直接用for 语句#遍历字符串a = 'asd'for q in a: print(q)# 输出结果为asd ……继续阅读 » 水墨上仙 5年前 (2020-11-16) 1961浏览 714个赞
python旋转图片的代码# rotate an image counter-clockwise using the PIL image library# free from: http://www.pythonware.com/products/pil/index.htm# make sure to install PIL after your……继续阅读 » 水墨上仙 5年前 (2020-11-16) 3099浏览 307个赞
python 计算字符串长度,一个中文算两个字符,先转换成utf8,然后通过计算utf8的长度和len函数取得的长度,进行对比即可知道字符串内中文字符的数量,自然就可以计算出字符串的长度了。来源:http://www.75271.comvalue=u'脚本12'length = len(value)utf8_length = ……继续阅读 » 水墨上仙 5年前 (2020-11-16) 2782浏览 2301个赞
python从网络端口读取文本数据# To test it with netcat, start the script and execute:# # echo "Hello, cat." | ncat.exe 127.0.0.1 12345#import socketHOST = 'localhos……继续阅读 » 水墨上仙 5年前 (2020-11-16) 1544浏览 1320个赞
windows下通过批处理获得本机mac地址@ECHO OFF:: Check OS versionIF NOT "%OS%"=="Windows_NT" GOTO SyntaxSETLOCAL:: Check command line argumentsIF NOT "%~2"……继续阅读 » 水墨上仙 5年前 (2020-11-16) 3114浏览 2318个赞
转自:http://blog.csdn.net/marising/article/details/6551692在很久以前,我写了一个系列,Python和C和C++的交互,如下http://blog.csdn.net/marising/archive/2008/08/28/2845339.aspx目的是解决Python和C/C++的互操作性的问题,假如……继续阅读 » 水墨上仙 5年前 (2020-11-16) 3307浏览 2648个赞
回文,亦称回环,是正读反读都能读通的句子,亦有将文字排列成圆圈者,是一种修辞方式和文字游戏。下面的代码用于检测一个字符串是否是回文/**检测回文串: * 先判断该字符的第一个和最后一个字符是否相等。如果相等,检查第二个字符和倒数第二个字符 * 是否相等。这个过程继续进行,直到出现不配陪的情况或者字符串的所有字符都检验完了。当字 ……继续阅读 » 水墨上仙 5年前 (2020-11-16) 2100浏览 244个赞
python显示生日是星期几# find the day of the week of a given date# Python will trap impossible dates like (1900, 2, 29)# tested with Python24 vegaseat 01aug2005from datetime i……继续阅读 » 水墨上仙 5年前 (2020-11-16) 1991浏览 2144个赞
python比较两段文本的不同之处# find the difference between two texts# tested with Python24 vegaseat 6/2/2005import difflibtext1 = """The World's Shortest Books:……继续阅读 » 水墨上仙 5年前 (2020-11-16) 2129浏览 2258个赞
C++通过递归进行回文判断#include using namespace std; //将一整数逆序后放入一数组中(要求递归实现) int IsRound(char *str,int len) { if(*str==*(str+len-1)) return IsRound(str+1,len-2); if(le……继续阅读 » 水墨上仙 5年前 (2020-11-16) 2487浏览 397个赞