
Python
文章平均质量分 66
SunJavaApplet
这个人很懒
展开
-
Python3源码升级
Python3.5升级到3.9.20、准备工作删除Python3的软链接,它是指向Python3.5的sudo rm /usr/bin/python3其他问题,网上有说要先安装libffi-devsudo apt install libffi-dev删除lsb_release,可能会出现以下错误subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status.原创 2021-03-10 13:36:11 · 832 阅读 · 0 评论 -
pycharm下载
我想更改此頁面的語言:简体中文繼續Developer ToolsTeam ToolsLearning ToolsSolutionsStorePyCharmWhat's NewFeaturesLearnBuyDownloadOther VersionsVersion2020.32020.3.2PyCharm Professional Edition2020.3.2 - Linux (tar.gz) 2020.3.2 - Linux wi...原创 2021-01-06 16:31:48 · 613 阅读 · 0 评论 -
从国家统计局获取最新国家省市区乡村5级行政区域代码名称数据
import requestsfrom bs4 import BeautifulSoupimport timeimport sqlite3import os import _threadclass Administrative(object): def __init__(self): self.db = sqlite3.connect('sqlite3.db',check_same_thread=False) sql='DROP TABLE...原创 2020-10-23 23:14:32 · 1407 阅读 · 0 评论 -
pandas中替换列名和单元格数据的方法。
df=df.rename(columns=lambda x: ",".join(x.split()) if type(x) is str else x)df = df.applymap((lambda x: "".join(x.split(',')) if type(x) is str else x)) #替换字符,正式可用的df = df.applymap(lambda x: str(str(x).replace(',', '-'))) #替换字符,正式可用的描述Pyt...原创 2020-10-23 20:00:43 · 1664 阅读 · 0 评论 -
用python解压缩zip文件
来自不同平台,不同系统的zip文件,打算用python的zipfile解压缩,后来发现zip文件对中文处理不友好,尝试了各种办法都是在文件名的编码上出错了。最后没办法用python的调用系统命令完美解决了压缩的文件def unzip_each_zip_package(path,fn): try: if zipfile.is_zipfile(fn): zf = zipfile.ZipFile(fn) for fName in zf.原创 2020-09-04 17:57:51 · 1079 阅读 · 0 评论 -
python Flask后台与前端页面传输JSON数据对象的处理方法
在Flask中将一个JSON数据传到页面上,并生成JS数组对象,view.py中的test()是向test.html传输一个JSON数据数据格式如下 {id:1,key:0,name:"水果"},{id:2,key:1,name:"杂粮"}def test(): data = getData() return render_template('test.html', jsondata=data)在test.html中需要进行JS处理,处理办法如下先将json...原创 2020-06-26 01:15:51 · 2633 阅读 · 0 评论 -
pip批量更新python插件
#!/usr/bin/env python# -*- coding: utf-8 -*-############################################################pip 10 版本以下可以用,#import pip#from subprocess import call#from pip._internal import get_ins...原创 2020-04-22 20:34:10 · 434 阅读 · 0 评论 -
pip使用阿里云镜像更新包
#!/usr/bin/env python# -*- coding: utf-8 -*-import pip# python3.7新版本需要需要导入下面的包from pip._internal.utils.misc import get_installed_distributionsfrom subprocess import callfrom time import s...原创 2019-10-21 14:30:46 · 950 阅读 · 0 评论