python编程
超人睡不着也变无奈
这个作者很懒,什么都没留下…
展开
-
python画图
https://blog.csdn.net/jinruoyanxu/article/details/53390943原创 2021-01-07 15:59:20 · 106 阅读 · 0 评论 -
python搜索es
https://www.jianshu.com/p/46372a2df051原创 2020-08-07 16:10:07 · 252 阅读 · 0 评论 -
python 跨域
server端加上header设为 Access-Control-Allow-Origin:*header(“Access-Control-Allow-Origin: *”); # 跨域处理原创 2020-07-29 11:09:18 · 122 阅读 · 0 评论 -
python lambda
# ===========一般写法:===========# 1、计算平方数def square(x): return x ** 2map(square, [1,2,3,4,5]) # 计算列表各个元素的平方# 结果:[1, 4, 9, 16, 25]# ===========匿名函数写法:============# 2、计算平方数,lambda 写法map(lambda x: x ** 2, [1, 2, 3, 4, 5])# 结果:[1, 4, 9, 16, 25] #原创 2020-07-29 11:03:24 · 179 阅读 · 0 评论 -
Flask
https://www.w3cschool.cn/flask/flask_routing.html原创 2020-07-28 19:03:31 · 71 阅读 · 0 评论 -
python shapely
https://shapely.readthedocs.io/en/latest/manual.html原创 2020-07-27 16:58:09 · 611 阅读 · 0 评论 -
python引用其他py文件中的内容
https://blog.csdn.net/lwgkzl/article/details/81161985转载 2020-04-06 21:18:14 · 335 阅读 · 0 评论 -
python邮件发送
import smtplibfrom email.header import Headerfrom email.mime.text import MIMETextfrom email.mime.multipart import MIMEMultipartfrom email.mime.application import MIMEApplicationdef sendmail(): ...原创 2019-09-16 16:21:10 · 375 阅读 · 0 评论 -
python3中sort实现自己的cmp函数
from functools import cmp_to_keydef cmp(a,b): return a-bnums = [1, 3, 2, 4]nums.sort(key=cmp_to_key(cmp))print(nums)原创 2019-09-10 21:17:39 · 592 阅读 · 0 评论 -
python中*和**的用法
https://blog.csdn.net/xiaoqu001/article/details/78823498转载 2019-06-13 12:33:51 · 737 阅读 · 0 评论 -
python列表中的排序方法
参考自https://www.cnblogs.com/whaben/p/6495702.html转载 2019-04-07 22:14:50 · 610 阅读 · 0 评论 -
python显示引用的库的版本
#load packagesimport sys #access to system parameters https://docs.python.org/3/library/sys.htmlprint("Python version: {}". format(sys.version))import pandas as pd #collection of functions for dat...原创 2019-04-11 15:06:29 · 595 阅读 · 0 评论 -
时间戳
获取这种类型的时间戳:0:00:05.436700可以starttime = datetime.datetime.now()datetime.datetime.now()-starttime获取秒的时间戳import timestarttime=time.time()print(time.time()-starttime)获取毫秒的时间戳import timestarttim...原创 2019-04-02 22:25:09 · 105 阅读 · 0 评论 -
读写txt
比如.py和data文件夹都在project目录下temp.txt已经创建好在data文件夹下则txtpath='./data/temp.txt'if os.path.exists(txtpath): print("ok exists" )else: print("wrong cant find")fobj=open(txtpath,'w')fobj.writ...原创 2019-04-02 22:49:05 · 148 阅读 · 0 评论 -
python得到文件夹下所有的某类型的文件
def gci(filepath,mylist):#遍历filepath下所有文件,包括子目录,注意是文件不包含文件夹 files = os.listdir(filepath) for fi in files: fi_d = os.path.join(filepath,fi) #print("----",fi_d) if os.path.isdir(fi_d)...原创 2019-04-09 14:36:07 · 659 阅读 · 0 评论 -
python json 操作以及pickle操作以及csv操作
以utf-8形式进行保存和读取;import jsonimport iodicts = {"name": "lucy", "sex": "boy"}json_dicts = json.dumps(dicts, indent=4)print(json_dicts)testjsonoutputpath="./data/testjsonoutput.json"with io.open(...原创 2019-04-04 14:24:31 · 211 阅读 · 0 评论