http://blog.youkuaiyun.com/oyzl68/article/details/8007153
常用类型转换
函数 描述
int(x [,base ]) 将x转换为一个整数
long(x [,base ]) 将x转换为一个长整数
float(x ) 将x转换到一个浮点数
complex(real [,imag ]) 创建一个复数
str(x ) 将对象 x 转换为字符串
repr(x ) 将对象 x 转换为表达式字符串
eval(str ) 用来计算在字符串中的有效Python表达式,并返回一个对象
tuple(s ) 将序列 s 转换为一个元组
list(s ) 将序列 s 转换为一个列表
chr(x ) 将一个整数转换为一个字符
mysql插入复杂字符串
http://blog.youkuaiyun.com/shellshine/article/details/8207448
cursor.execute(“insert into resource(cid,name) values(%s, %s)” , (12,name) );
(两个参数)
或用方法预先处理字符串
name = MySQLdb.escape_string(name);
cursor.execute(“insert into resource(cid,name) values(%s, ‘%s’)” % (12,name) );
mac ssh翻墙:
http://blog.wanjie.info/2010/04/mac-os%E4%B8%8Bssh%E7%BF%BB%E5%A2%99-%E8%BD%AC%E8%BD%BD/
打开终端:
ssh -D 1080 sshuser@sshhost.com 会提示你输入ssh的密码
然后到系统设置里,修改网络配置,修改网络配置里的socks代理为127.0.0.1,端口1080,关闭 ,
获取html源码中的文字,排除标签
http://blog.youkuaiyun.com/xyw_blog/article/details/41854941
http://blog.youkuaiyun.com/bagboy_taobao_com/article/details/15340547
from HTMLParser import HTMLParser
class MyHTMLParser(HTMLParser):
def __init__(self):
self.reset()
self.fed = []
def handle_data(self, d):
self.fed.append(d)
def get_data(self):
return ''.join(self.fed).encode('utf-8')
git cloning出错:
The remote end hung up unexpectedly while git cloning
http://stackoverflow.com/questions/6842687/the-remote-end-hung-up-unexpectedly-while-git-cloning
尝试:
git config --global http.postBuffer 524288000
# some comments below report having to double the value:
git config --global http.postBuffer 1048576000
如果仍出现,1.服务器超时设置太端,网络不够快,不足以在短的时间内下载完