随笔分类 - python
摘要:class Test(object): def __init__(self): self.name = "汪 汪" self.girl = "liu cc" # 对象当作方法使用回调 def __call__(self, lover): return lover # 打印对象 def __str__(s...
阅读全文
摘要:from matplotlib import font_manager#解决zh-han图形汉字乱码 my_font = font_manager.FontProperties(fname="C:/Windows/Fonts/simsun.ttc") def draw_xmap(x_list,y_list): """ daily map draw """ try: ...
阅读全文
摘要:1.New a python project 2.cd %project.home%切换到项目根目录3.运行setup.bat创建venv虚拟环境 (注意内网运行setup.bat需要手动将requirements.txt需要的安装包下载下到dependency目录(pip download -d
阅读全文
摘要:临时修改(建议)pypi镜像源方法:如果有untrust 报错,可使用https开头的网站,或加上--trusted 例如: pip install pywin32 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.al
阅读全文
摘要:有些情况下我们需要下载N个第三方包,或者下载的包依赖其它包,一个个下载非常浪费时间。这时我们可以通过如下两种方式的命令批量下载。 方式1 pip download -d /tmp/packagesdir 方式2 pip download -d /tmp/packagesdir -r requirements.txt 其中requirements.txt是我们需要下载的包清单,例如 jin...
阅读全文
摘要:from functools import reduce list1=list2=list3=["a","b","c","d"]排列组合a,b,c.d 组合3成字母字符串结果不重复一共多少种?方法一: def add(x,y): return [str(i)+str(j) for i in x for j in y] result=reduce(add,[list1,list2,list3...
阅读全文
摘要:1.格式化: param=111 {“k”: "{}".format(param)} 2.字符串替换: string=“aaabbb" # from aaa to oooo string.replace("aaa","oooo") 4.字符串去空格: string=“ aa bb ccccc ” s
阅读全文
摘要:官网地址: http://cn.python-requests.org/zh_CN/latest/ 高级用法 本篇文档涵盖了 Requests 的一些高级特性。 会话对象 会话对象让你能够跨请求保持某些参数。它也会在同一个 Session 实例发出的所有请求之间保持 cookie, 期间使用 url
阅读全文
摘要:请在终端(Mac / Linux)或命令提示符(Windows)上运行以下命令: jupyter notebook登录地址在cmd安装运行完jupyter notebook运行最后会提示 Jupyter的通用配置方法:官网很详细了 指定启动端口,使用以下语法: jupyter notebook --
阅读全文
摘要:python channel_builder.py -s /Users/graypn/ -d /Users/graypn/Documents -m 7 --out=report/xx.html 参数也分长格式和短格式 短格式:-s 长格式:--source opts, args = getopt.g
阅读全文
摘要:import base64 str='admin' str=str.encode('utf-8') #加密 bs64=base64.b64encode(str) #解密 debs64=base64.b64decode(bs64) print(debs64.decode("utf-8")) #base32bit加密 bs32=base64.b32encode(str) #b32解密 debs32=...
阅读全文
摘要:for windows : for linux
阅读全文
摘要:记录了Linux 安装python3.7.0的详细过程,供大家参考,具体内容如下 我这里使用的时centos7-mini,centos系统本身默认安装有python2.x,版本x根据不同版本系统有所不同,可通过 python --V 或 python --version 查看系统自带的python版
阅读全文
摘要:前置准备yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc makeyum install libffi-devel -ypython linu
阅读全文
摘要:googlechrome webdriver驱动下载 addrhttps://sites.google.com/a/chromium.org/chromedriver/downloads谷歌浏览器app下载https://www.chromedownloads.net/###############
阅读全文
摘要:3.7版本需要一个新的包libffi-devel,安装此包之后再次进行编译安装即可。 若在安装前移除了/usr/bin下python的文件链接依赖,此时yum无法正常使用,需要自己下载相关软件包安装,为节省读者时间,放上链接 #wget http://mirror.centos.org/centos
阅读全文
摘要:#! /usr/bin/python # -*- coding: utf-8 -*- import os print os.environ['HOME'] print os.path.expandvars('$HOME') print os.path.expanduser('~')
阅读全文
摘要:https://www.python.org/ftp/python
阅读全文


浙公网安备 33010602011771号