
python
xxt_困困
这个作者很懒,什么都没留下…
展开
-
python3.8安装mysql找不到模块
python mysql的whl链接:(进去直接搜mysql)安装mysqlclient开头的文件,选择对应python版本https://www.lfd.uci.edu/~gohlke/pythonlibs/下载并放到python的Scripts文件夹中cmd用pip install 下载的文件结束:进入python 使用import MySQLdb校验是否成功...原创 2020-01-03 18:30:29 · 2721 阅读 · 0 评论 -
centos6安装python3
下载安装包wget https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz下载python3.6的tar包,如果服务器网络不好,可以先下载到自己的电脑上,然后通过rscyn命令传输到服务器上面。比如我在百度云的服务器上用wget下载就非常慢,于是就本地开代理下了tar包,然后传输到服务器上。 rsync Python-3.6....原创 2018-08-29 22:22:18 · 476 阅读 · 0 评论 -
python的post请求实例
#coding=utf-8import jsonimport urllib2import base64import sys# start=sys.argv[1]# end=sys.argv[2]# DEFAULT_URL =""DEFAULT_URL =""auth = base64.b64encode("admin" + ':' + "admin")for i in ...原创 2018-08-01 15:56:03 · 2177 阅读 · 0 评论 -
python去除文件中数据前的空格,去除文件中的空行
with open (r'E:/tadb.out') as f: for line in f.readlines(): line=line.lstrip() print (line) with open('E:/1.out','a') as f2: f2.write(line)mq1=open('E:/mqtt...原创 2018-07-26 19:47:44 · 4804 阅读 · 0 评论 -
python判断目录为空
#!/usr/bin/python# encoding=utf-8import osimport shutilimport subprocessimport timeimport syssrc = "/xxy/aa"desc = "/xxy/bb/"def setDir(): if not os.path.exists(desc): os.mkdir(...原创 2020-01-03 18:34:57 · 602 阅读 · 0 评论 -
python3 操作数据库
import pymysql# 打开数据库连接 db = pymysql.connect(host='127.0.0.1',user='root',passwd='919824467',db='mysql') # 使用 cursor() 方法创建一个游标对象 cursor cur = db.cursor() #数据库语句 cur.execute('CR...原创 2018-07-02 17:09:15 · 761 阅读 · 0 评论 -
python管理linux的进程
#!的/ usr / bin中/蟒蛇#coding = utf-8导入系统进口口进口时间进口信号Max_process = 2log_index = 0def start(): 全局Max_process 全局log_index #获取当前路径 path = os.popen('pwd')。readlines()[0] 而(1):...原创 2018-07-08 14:33:53 · 940 阅读 · 0 评论 -
python 库分类大全
网络通用urllib -网络库(stdlib)。requests -网络库。grab – 网络库(基于pycurl)。pycurl – 网络库(绑定libcurl)。urllib3 – Python HTTP库,安全连接池、支持文件post、可用性高。httplib2 – 网络库。RoboBrowser – 一个简单的、极具Python风格的Python库,无需独立的浏览器即可浏览网页。Mecha...原创 2018-06-19 14:34:14 · 1959 阅读 · 0 评论 -
python2 往mysql插入数据
#coding=utf-8import MySQLdbimport datetimedb = MySQLdb.connect("localhost","root","123456","test",charset = 'utf8')cursor = db.cursor()sql="sql语句"try: # 执行sql语句 cursor.execute(sql) # 提交到数据库执...原创 2018-06-29 12:17:17 · 618 阅读 · 0 评论 -
ubunbu,window安装Python
window:1.官网下载需要的python版本,配置环境变量2.下载pip包:https://bootstrap.pypa.io/get-pip.py,配置pip的环境变量3.安装完成后在cmd分别使用python和pip list验证python和pip是否安装成功4.都ok后,就可以使用pip install 模块来安装ubunbu:1.源码安装:已知源码的地址,例如:https://www...原创 2018-06-15 18:11:58 · 321 阅读 · 0 评论 -
python学习 第一天 收集资料
练习githup上的python练习题:https://github.com/Yixiaohan/show-me-the-code原创 2018-06-01 10:36:18 · 347 阅读 · 0 评论