
Python
py
tangbin0505
微信
展开
-
centos安装py3
1把原先的2.7版本备份一下cd /usr/binls python*mv python python.bak2py软件包下载mkdir /usr/local/python3cd /usr/local/python3wget https://www.python.org/ftp/python/3.8.3/Python-3.8.3.tgz3解压和编译安装tar -xvf Python-3.8.3.tgz cd Python-3.8.3/./configure --p...原创 2020-10-29 17:15:10 · 141 阅读 · 0 评论 -
log文件生成
import loggingfh = logging.FileHandler(filename='xxx.log',encoding='utf-8')fh1 = logging.FileHandler(filename='xxx2.log',encoding='utf-8')sh = logging.StreamHandler()logging.basicConfig(level=logging.INFO, handlers=[fh,sh,fh1], .原创 2020-06-14 17:03:07 · 1443 阅读 · 0 评论 -
PyCharm快捷键
Ctrl+d 快速复制粘贴上一行Ctrl+z 撤销Ctrl+Shift+z 撤销撤回Ctrl+? 注释/取消注释Ctrl+Alt+I 代码规范整理原创 2020-06-10 11:18:05 · 289 阅读 · 0 评论 -
3 列表循环-字典循环-删除-文件操作
1列表循环for item in lst: 如果你只需要拿到元素for i in range(len(lst)): 不光需要拿到元素, 还需要拿到索引inlstlst = ["小姨多鹤_sb", "linux核心编程_sb", "shell脚本大全_sb", "linux私房菜_sb"]for item in lst: item = item.replace("...原创 2019-12-29 20:21:36 · 504 阅读 · 0 评论 -
2 格式化-运算符-基本数据类型-字符串操作
1 格式化输出%s 字符串%d 占位数字%f 占位小数name = input(">>:")address = input(">>>")hobby = input(">>>")# %s 表示字符串的占位, 可以传递任何数据类型# %d 表示数字的占位# 方式1# s = "我叫%s, 我喜欢在%s%s" % (name,...原创 2019-12-29 19:14:50 · 239 阅读 · 0 评论 -
List-Dict-Set-元祖-字符串-用户交互-if语句-while循环-break和continue
一 List lst =list() []列表,用来存放大数据集的数据 [], 内部可以使用任何数据类型的数据. 由逗号隔开 索引和切片与字符串一模一样 list数据可以重复lst=["张三","李四","张三"] 可以将list放到集合中,去重复s=set(lst) print(s),列表变成集...原创 2019-12-22 22:35:58 · 161 阅读 · 0 评论 -
py部署运行
安装依赖yum -y install epel-releaseyum -y install python-pippip install pyinstallerpip install --upgrade pip安装web.pypip install web.pygithub获取最新版安装,解压git clone git://github.com/webpy/webpy.g...原创 2019-12-20 15:46:34 · 189 阅读 · 0 评论