python 字符串转换,mysql插入带引号字符串,获取html纯文字

20 篇文章 0 订阅

http://blog.csdn.net/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.csdn.net/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.csdn.net/xyw_blog/article/details/41854941
http://blog.csdn.net/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.服务器超时设置太端,网络不够快,不足以在短的时间内下载完

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值