随笔分类 -  python

just share my attitude about python
py 之xlsxwriter 操作生成柱状图,饼图。
摘要:1 import xlsxwriter 2 import time 3 4 def charts(product_name, dict_data, crash_data_list, report_path): 5 if len(dict_data) <= 0 or len(crash_data_li 阅读全文

posted @ 2022-01-11 16:21 流若浅 阅读(125) 评论(0) 推荐(0) 编辑

py 之impala数据库连接
摘要:from impala.dbapi import connect conn = connect(host='127.0.0.1', port=21050) cur = conn.cursor() sql_cmd = 'select name from data.user_data where env 阅读全文

posted @ 2022-01-11 16:15 流若浅 阅读(313) 评论(0) 推荐(0) 编辑

python http post简单例子
摘要:仅做post跟返回,一般作为接口测试数据请求以及返回数据是否正确,辅CPP #code=utf-8import requestsimport sys data = {'account': '12345678@qq.com', 'pass': 'llq', 'type': '0', 'level': 阅读全文

posted @ 2021-04-21 12:28 流若浅 阅读(840) 评论(0) 推荐(0) 编辑

python 获取时间戳相关计算
摘要:代码即注释,获取当前时间,当前时间上个月,当前时间下个月,当前时间上一周下一周,字符串转换时间戳 获取当年每个月第一天,最后一天,api不清楚ilde直接查一下或者百度即可,非常简单. import datetimeimport timeimport calendarimport calendar 阅读全文

posted @ 2021-04-21 11:35 流若浅 阅读(984) 评论(0) 推荐(0) 编辑

python 脚本编译成可执行二进制(exe)
摘要:本文python3,pyinstaller也支持py2 cmd下载模块pyinstaller 首先: pip install pyinstaller 其次: cmd下进入需要编译的xxx.py文件目录下 cd C:/photo pyinstaller -F xxx.py 可执行程序就在dist文件夹 阅读全文

posted @ 2019-10-20 23:02 流若浅 阅读(3123) 评论(0) 推荐(0) 编辑

python 小工具 重命名当前文件夹内所有的文件,升序命名
摘要:背景:一个朋友想升序重命名他的照片,但是太多了不想手动所以,emememem os这个模块,不用说,rename,filedir等 #conding=utf8 import os path = os.walk(r'C:\photo') filecount = 0 for path,dir_list, 阅读全文

posted @ 2019-10-20 22:56 流若浅 阅读(402) 评论(0) 推荐(0) 编辑

python3.x __str__与__repr__
摘要:__repr__和__str__用于显示,__str__是面向用户的,而__repr__面向coder【调试与开发】 repr(默认交互式回显)【来自python入门】 str(也就是打印语句) 一般用途 输出的话先调用__str__,通常返回时字符串显示, 打印操作会先尝试__str__和str内 阅读全文

posted @ 2019-08-20 16:29 流若浅 阅读(303) 评论(0) 推荐(0) 编辑

python3.x 匿名函数lambda_扩展sort
摘要:#匿名函数lambda 参数: 表达式关键字 lambda 说明它是一个匿名函数,冒号 : 前面的变量是该匿名函数的参数,冒号后面是函数的返回值,注意这里不需使用 return 关键字。 ambda只是一个表达式,函数体比def简单很多。 lambda的主体是一个表达式,而不是一个代码块。仅仅能在l 阅读全文

posted @ 2019-08-06 16:05 流若浅 阅读(360) 评论(0) 推荐(0) 编辑

python3.x filter,map,reduce浅析
摘要:#map用法: #传递函数api进入map去执行,把字符串第一个字母变大写, #其他变小写返回 def format_name(s): s=s.lower() print(s) return s[0].upper()+s[1:] print map(format_name, ['adam', 'LI 阅读全文

posted @ 2019-08-06 15:47 流若浅 阅读(543) 评论(0) 推荐(0) 编辑

python3.x 浅谈修饰器
摘要:#装饰器用法,好处#简化代码,避免重复性代码#打印日志 @log#检测性能 @performance#数据库事务 @transaction#URL路由 @post('/register') 简单例子: @new_addlogdef function(x): return x*2等价于 >>def f 阅读全文

posted @ 2019-08-06 15:30 流若浅 阅读(476) 评论(0) 推荐(0) 编辑

python3.x 扯扯【切片】这玩意儿
摘要:在此之前先了解一下list这个玩意儿: list对应cpp这的数组,一维数组,二维数组,或者是嵌套都行: L=[] #空列表 L=[1,2,3,4,5,6] #六项 L=['a',['b','c']] #嵌套子列表 L=list(range(0,5))#range 初始化list,0-4 可以使用d 阅读全文

posted @ 2019-08-06 15:22 流若浅 阅读(125) 评论(0) 推荐(0) 编辑

python3.x 类似cpp引用指针传参修改
摘要:#同名局部变量调用外部全局变量: num=100def fun(): global num#告诉编译器是全局的num num+=100 print(num)print(fun)print(fun())#print(fun()) 局部变量没有初始化报错,局部变量覆盖全局变量, #类似Cpp引用,返回值 阅读全文

posted @ 2019-08-06 13:04 流若浅 阅读(431) 评论(0) 推荐(0) 编辑

python3.x current_question
摘要:扩散四维过程遇到的问题,暂不能解决,但先收集起来. ''' list_str=['test', None, '', 'str', ' ', 'END'] data = filter(lambda str:str and len(str.strip())>0, list_str)print('data 阅读全文

posted @ 2019-08-06 12:58 流若浅 阅读(186) 评论(0) 推荐(0) 编辑

python 环境准备-centos7
摘要:python3环境搭建【本身centosyum底层也是py2.x实现的,装3.x的时候要实现多版本共存这里解决了这些问题】 安装编译环境# yum -y groupinstall 'Development Tools'# yum -y install zlib-devel bzip2-devel o 阅读全文

posted @ 2019-08-06 12:49 流若浅 阅读(442) 评论(0) 推荐(0) 编辑

第一次玩蛇,有点紧张。
摘要:第一次玩蛇,不知道怎么样才能假装是熟练的印度玩蛇人?在线等,有点着急。233333 怎么下载安装这些不说了,正常人都会的,不正常的看完本文请及时就医,以免影响正常工作。刚玩的蛇是 3.6.2 x64 windows专业版 (不清楚有些x86下设置会失败,不行的话评论我到时候做个链接放上来,我自己把笔 阅读全文

posted @ 2017-10-10 22:23 流若浅 阅读(220) 评论(0) 推荐(0) 编辑

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

导航

统计

点击右上角即可分享
微信分享提示