Python常用代码备忘
使用清华pip源安装软件
1
pip3 install jupyter -i https://pypi.tuna.tsinghua.edu.cn/simple/
去除HTTP协议头,
http://baidu.com
->baidu.com
1
domain = re.sub('https?://', '', domain, flags=re.IGNORECASE)
把字符串内多个空格合并成一个空格,
' '
->' '
1
line = re.sub(' +', ' ', line)