python3
文章平均质量分 66
weixin_52832343
这个作者很懒,什么都没留下…
展开
-
python json模块使用
JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式,易于人阅读和编写。Json API 使用:python在版本2.6之前,是需要先下载包,安装后才能使用的。Python2.6 以上版本支持Json的编码和解码,支持python的大部分内置类型与Json进行转换。Python3 中可以使用 json 模块来对 JSON 数据进行编解码,它主要提供了四个方法: dumps、dump、loads、load。一、dump和dumpsdump和dumps对pyth原创 2021-11-01 19:13:01 · 222 阅读 · 0 评论 -
python os模块使用
一、模块介绍模块导入方式: import osos模块是Python标准库中的一个用于访问操作系统相关功能的模块,os模块提供了一种可移植的使用操作系统功能的方法。使用os模块中提供的接口,可以实现跨平台访问。但是,并不是所有的os模块中的接口在全平台都通用,有些接口的实现是依赖特定平台的,比如linux相关的文件权限管理和进程管理。os模块的主要功能:系统相关、目录及文件操作、执行命令和管理进程在使用os模块的时候,如果出现了问题,会抛出OSError异常,表明无效的路径名或文件名,或者路径名(文原创 2021-10-22 17:39:52 · 257 阅读 · 0 评论 -
python fileinput模块使用
fileinput模块可以对一个或多个文件中的内容进行迭代、遍历等操作。该模块的input()函数有点类似文件readlines()方法,区别在于前者是一个迭代对象,需要用for循环迭代,后者是一次性读取所有行。用fileinput对文件进行循环遍历,格式化输出,查找、替换等操作,非常方便。【典型用法】import fileinputfor line in fileinput.input():process(line)【基本格式】fileinput.input([files[, inplac原创 2021-10-20 19:54:00 · 184 阅读 · 0 评论 -
centos7.3+ python3.7 +selenium3.141.0+ chrome93 + chromedriver93
先安装:最新的chromeyum install https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpmgoogle-chrome --versionGoogle Chrome 93.0.4577.82到 https://npm.taobao.org/mirrors/chromedriver/下载相应的版本驱动:wget https://npm.taobao.org/mirrors/chromedri原创 2021-10-09 09:15:00 · 114 阅读 · 0 评论 -
centos7.3+python3.7.12+selenium3.141.0+firefox60.2.0+geckodriverv0.23
pip37 install seleniumpip37 show seleniumName: seleniumVersion: 3.141.0Summary: Python bindings for SeleniumHome-page: https://github.com/SeleniumHQ/selenium/Author: UNKNOWNAuthor-email: UNKNOWNLicense: Apache 2.0Location: /usr/local/python3.7.12/原创 2021-10-08 16:55:23 · 175 阅读 · 0 评论 -
centos7.3 编译Python-3.7.12
yum -y groupinstall “Development tools”yum -y install bzip2-devel ncurses-devel gdbm-devel libdhash-devel sqlite-devel openssl-devel tk-devel readline-devel zlib-devel db4-devel libpcap-devel xz-devel libffi-develwget https://www.python.org/ftp/python/3.原创 2021-10-01 09:00:00 · 154 阅读 · 0 评论 -
python3 configparser 解析ini 文件
python2下该模块名为ConfigParser,到3才改为configparser,可以看官方ConfigParser模块的说明ConfigParse 官方文档https://docs.python.org/3.6/library/configparser.htmlpython3中configparser模块的使用,configparser模块是用来解析ini配置文件的解析器,关于ini配置文件的结构可以看python官方文档中的介绍:ini文件结构ini文件结构需要注意一下几点:键值对可用原创 2021-09-30 10:10:59 · 151 阅读 · 0 评论 -
centos6.9 python3.6 安装pymongo-3.11.1
[ /usr/local/bin]# pip3 install pymongoYou are using pip version 9.0.1,however version 20.0.2 is availableYou should consider upgrading via the ‘python -m pip install --upgrade pip’ command.[ /usr/local/bin]# pip3 -Vpip 9.0.1 from /usr/local/lib/python原创 2021-09-28 09:49:54 · 170 阅读 · 0 评论