![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
weixin_33595571
TensorFlow
展开
-
python txt文件去除数字字母只保留中文
【代码】python txt文件去除数字字母只保留中文。原创 2022-11-02 23:08:39 · 1135 阅读 · 0 评论 -
python txt文件去除数字字母只保留中文
【代码】python txt文件去除数字字母只保留中文。原创 2022-11-02 11:38:25 · 945 阅读 · 0 评论 -
python mean()求平均值
【代码】python mean()求平均值。原创 2022-09-07 17:57:17 · 4323 阅读 · 0 评论 -
python修饰器解析
python中的装饰器是增强函数或类的功能的一个函数 / 类,是闭包(closure)的一种应用。通过使用装饰器,我们可以在不修改原函数代码的前提下拓展函数的功能。定义前添加一个装饰器名和@符号,来实现对函数的自动包装。修饰器是增加函数额外功能(这种功能大多是通用的)。...原创 2022-09-01 11:35:17 · 242 阅读 · 0 评论 -
python版 我的世界
from __future__ import divisionimport sysimport mathimport randomimport timefrom collections import dequefrom pyglet import imagefrom pyglet.gl import *from pyglet.graphics import TextureGroupfrom pyglet.window import key, mouse# 每秒帧数TICKS_P.原创 2021-05-14 04:12:02 · 1203 阅读 · 2 评论 -
Android客户端和python服务端查询数据并返回查询结果
服务端import socketimport sysfrom time import ctimedef FindMusicName(MusicName): f = open('musicName3.txt','r',encoding='utf8') for lines in f.readlines(): if lines.find("马桃")!=-1: print(lines) print("find it .....原创 2020-06-20 07:54:49 · 300 阅读 · 0 评论 -
Android客户端和Python3服务器通信
import socketimport sysfrom time import ctime# 1.socket(socket_family, socket_type, protocol=0)# 其中,socket_family 是 AF_UNIX 或 AF_INET,ocket_type 是 SOCK_STREAM或 SOCK_DGRAM, protocol 通常省略,默认为 0。# 为了创建 TCP/IP 套接字,可以用下面的方式调用 socket.socket()。# tcpSock .原创 2020-06-19 08:28:34 · 449 阅读 · 0 评论 -
python3 sock 编程 通信
服务端import socketimport sysfrom time import ctime# 1.socket(socket_family, socket_type, protocol=0)# 其中,socket_family 是 AF_UNIX 或 AF_INET,ocket_type 是 SOCK_STREAM或 SOCK_DGRAM, protocol 通常省略,默认为 0。# 为了创建 TCP/IP 套接字,可以用下面的方式调用 socket.socket()。# tcpSo原创 2020-06-19 08:12:43 · 122 阅读 · 0 评论 -
python 打印本机IP MAC地址
# -*- coding: utf-8 -*-import socket#获取本机电脑名myname = socket.getfqdn(socket.gethostname( ))#获取本机ipmyaddr = socket.gethostbyname(myname)print(myname)print(myaddr)原创 2020-06-18 16:47:27 · 589 阅读 · 0 评论 -
python通过图片对比 控制酷我音乐下载歌曲
# -*- coding:utf-8 -*-import timeimport win32guiimport win32uiimport win32apiimport win32conimport pyautoguiimport pyperclipfrom pykeyboard import *from pymouse import *import osfrom PIL import Imagefrom PIL import ImageGrabimport cv2impo原创 2020-06-18 07:01:30 · 306 阅读 · 0 评论 -
python 图片匹配
import timeimport win32guiimport win32uiimport win32apiimport win32conimport pyautoguiimport pyperclipfrom pykeyboard import *from pymouse import *from PIL import ImageGrabhWind=460082x=310y=25rect = win32gui.GetWindowRect(hWind);print(原创 2020-06-14 11:59:53 · 565 阅读 · 0 评论 -
python打印所有进程
import psutilpids = psutil.pids()for pid in pids: p = psutil.Process(pid) print("pid-%d,pname-%s" %(pid,p.name()))原创 2020-06-14 07:38:23 · 537 阅读 · 0 评论 -
python实时获取鼠标位置
import os,timeimport pyautogui as pagtry: while True: print("Press Ctrl-C to end") x,y = pag.position() #返回鼠标的坐标 posStr="Position:"+str(x).rjust(4)+','+str(y).rjust(4) print (posStr)#打印坐标 t.原创 2020-06-14 06:57:25 · 1523 阅读 · 0 评论 -
python截屏保存图片
import timeimport win32gui, win32ui, win32con, win32apidef window_capture(filename): hwnd = 0 # 窗口的编号,0号表示当前活跃窗口 # 根据窗口句柄获取窗口的设备上下文DC(Divice Context) hwndDC = win32gui.GetWindowDC(hwnd) # 根据窗口的DC获取mfcDC mfcDC = win32ui.CreateDCFrom原创 2020-06-13 18:54:45 · 1153 阅读 · 0 评论 -
python图片中的物体查找并保存
import cv2import aircv as acimport pyautoguiimport matplotlib.pyplot as pltimport numpy# print circle_center_posdef draw_circle(img, pos, circle_radius, color, line_width): cv2.circle(img, pos, circle_radius, color, line_width) cv2.imshow('o原创 2020-06-13 18:43:15 · 703 阅读 · 1 评论 -
python找出图片位置 检查两个图片相对位置
import cv2import aircv as acimport pyautoguiimport matplotlib.pyplot as pltimport numpy# print circle_center_posdef draw_circle(img, pos, circle_radius, color, line_width): cv2.circle(img, pos, circle_radius, color, line_width) cv2.imshow('o原创 2020-06-13 08:35:02 · 2476 阅读 · 0 评论 -
python窗口置顶 并输入中文
使用pip install * 安装包64位安装不成功,改用32位安装成功x=0y=0x=rect[0]+310y=rect[1]+25#窗口置顶win32gui.SetWindowPos(198188,win32con.HWND_TOPMOST,0,0,0,0,win32con.SWP_NOSIZE);for i in rect: print(i) print(type(i)) print("移动鼠标到XY位置")win32api.SetCursorPos(原创 2020-06-13 07:23:32 · 818 阅读 · 0 评论 -
Python 移动鼠标到 句柄指定位置
pip install win32guiimport timeimport win32guiimport win32uiimport win32apiimport win32conprint("dddddddddddddddd")rect = win32gui.GetWindowRect(132688);print(rect)print(type(rect))x=0y=0x=rect[0]+310y=rect[1]+25for i in rect: print(i原创 2020-06-12 08:28:26 · 1376 阅读 · 0 评论 -
Python3 http 服务任意目录 设定访问目录
cmd 切换到要访问的文件夹D:运行命令python -m http.server 8001最后端口号自己定义原创 2020-06-12 06:58:34 · 3003 阅读 · 0 评论 -
python 字符串替换 本地地址转换为网络地址
f = open('MUSICFile.txt','r',encoding='utf8')w = open('MyError.txt','w',encoding='utf8')for lines in f.readlines(): print(lines[2:]) w.write("http:\\\\192.168.1.2"+lines[2:]); #print(lines,end='')f.close()w.close()原创 2020-06-12 01:21:07 · 527 阅读 · 0 评论 -
python 查找txt文件中的字符串
findMusic="BLACKPINK-BOOMBAYAH";MusicLine=0;f = open('musicName12.txt','r',encoding='utf8')for lines in f.readlines(): MusicLine=MusicLine+1; if lines.find(findMusic)!=-1: print(lines) print("find it .........................")原创 2020-06-12 00:43:56 · 8097 阅读 · 0 评论 -
python 3 读取文件txt 打印print
# -*- coding: utf-8 -*-f = open('musicName12.txt','r',encoding='utf8')for lines in f.readlines(): print(lines,end='')f.close()原创 2020-06-10 21:09:03 · 4241 阅读 · 0 评论 -
python 将文件名写入 txt文件
# -*- coding: utf-8 -*-"""Created on Wed Jun 10 18:31:11 2020@author: xxxd"""import osimport syspath="G:\\BaiduNetdiskDownload\\最新月份(抖音热曲)";with open("musicName3.txt",'a',encoding='utf-8') as filetext: for root,dirs,files in os.walk(path):原创 2020-06-10 18:54:14 · 1580 阅读 · 0 评论 -
python 批量修改文件名称去除文件名中空格
# -*- coding: utf-8 -*-"""Spyder 编辑器这是一个临时脚本文件。"""import os print("**********************************************") path="E:\\FileTest";#walk方法会返回一个三元组,分别是root、dirs和files。#其中root是当前正在遍历的目录路径;dirs是一个列表,包含当前正在遍历的目录下所有#的子目录名称,不包含该目录下的文件;file原创 2020-06-10 17:28:55 · 1856 阅读 · 0 评论 -
python 遍历文件夹及文件
# -*- coding: utf-8 -*-"""Spyder 编辑器这是一个临时脚本文件。"""import osfor filename in os.listdir(r'd:\\'): print(filename); path="d:\\";for root,dirs,files in os.walk(path): for name in files: print(os.path.join(root,name)) for原创 2020-06-09 18:51:13 · 141 阅读 · 0 评论 -
股票001 获得股票代码600569
QQ群:476842922(欢迎加群讨论学习)import tushare as tsimport pandasimport datetimetickersRawData = ts.get_stock_basics()#活动股票数据print(tickersRawData)tickers = tickersRawData.index.tolist()#获得股票代码print(ti...原创 2019-05-26 16:20:33 · 307 阅读 · 0 评论 -
下载及安装selenium IDE
下载及安装selenium IDE安装方法1:可以从官方网站下载:http://seleniumhq.org/download/,但是由于selenium服务器在美国,中美的网络经常不稳定,经常会连接失败,导致下载不了可以找一下selenium IDE插件的XPI安装文件来完成安装。安装方法2:可以用Firefox打开https://addons.mozilla.org/en-US/fire...转载 2019-03-21 08:46:09 · 1220 阅读 · 0 评论 -
python selenium搜索百度
# -*- coding: utf-8 -*-"""Created on Fri Mar 15 17:07:26 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""#install pip selenium#下载webdriver geckodriver.exeimport timefrom selenium import ...原创 2019-03-16 01:17:01 · 208 阅读 · 0 评论 -
列表嵌套与打印2
# -*- coding: utf-8 -*-"""Created on Wed Feb 13 12:52:17 2019@author: Administrator"""import timeimport osimport difflibif __name__ == '__main__': a = '123456a' b = '234567b' Str...原创 2019-02-13 23:55:09 · 163 阅读 · 0 评论 -
python3 计算字符串相识度
# -*- coding: utf-8 -*-"""Created on Wed Feb 13 12:52:17 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""import difflibif __name__ == '__main__': a = '123456a' b = '234567b' S...原创 2019-02-13 17:16:28 · 180 阅读 · 2 评论 -
按时间对文件夹下文件进行排序
path = "F:\\PythonWebPYCode\\mma"listS = os.listdir(path)print(listS)print("*************************")listS = sorted(listS, key=lambda x: os.path.getmtime(os.path.join(path, x)))print(listS)p...原创 2019-02-13 01:06:31 · 922 阅读 · 0 评论 -
列表的嵌套输出
QQ群:476842922(欢迎加群讨论学习)matrix =[[1,2,3,4],[5,6,7,8],[9,10,11,12]]print(matrix)for i in matrix : print(i) for m in i: print(m)[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12]][1, 2, 3...原创 2019-02-12 23:17:10 · 291 阅读 · 0 评论 -
截屏python
import timefrom PIL import ImageGrab time.sleep(3)# 参数说明# 第一个参数 开始截图的x坐标# 第二个参数 开始截图的y坐标# 第三个参数 结束截图的x坐标# 第四个参数 结束截图的y坐标#bbox = (0, 0, 1920, 1080)im = ImageGrab.grab() #截取整个屏幕# 参数 保存截图文件的路径...转载 2019-01-18 15:04:34 · 675 阅读 · 0 评论 -
python读写excel文件
# -*- coding: utf-8 -*-"""Created on Thu Jun 13 22:12:26 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""# -*- coding: utf-8 -*-# 读写2003 excelimport xlrdimport xlwt# 读写2007 excelimport ...原创 2019-06-13 22:16:58 · 323 阅读 · 0 评论 -
HtmlParser 是解析Html的一个工具
# -*- coding: utf-8 -*-"""Created on Sun Jun 9 16:45:18 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""#HtmlParser,是解析Html的一个工具。from html.parser import HTMLParserclass MyHTMLParser(HTML...原创 2019-06-09 16:57:08 · 3100 阅读 · 0 评论 -
通过http网页链接下载单词音频文件
# -*- coding: utf-8 -*-"""Created on Sun Jun 9 18:41:01 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""#download file from selected urlimport urllib.requesturl="https://dictionary.blob.c...原创 2019-06-09 18:58:56 · 1633 阅读 · 0 评论 -
根据单词列表通过网络下载单词发音
# -*- coding: utf-8 -*-"""Created on Sun Jun 9 18:02:11 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""import urllib.requestfrom lxml import etreeimport re import timefrom functools im...原创 2019-06-09 19:36:15 · 786 阅读 · 0 评论 -
wxPython 窗口程序01
# -*- coding: utf-8 -*-"""Created on Mon Jun 10 03:56:09 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""#-*- coding: utf-8 -*-import wximport win32apiimport sys,osAPP_TITLE = u'基本框架'...原创 2019-06-10 04:01:08 · 229 阅读 · 0 评论 -
wxPython 事件绑定
# -*- coding: utf-8 -*-"""Created on Mon Jun 10 03:56:09 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""import wximport win32apiimport sys, osAPP_TITLE = u'控件事件、鼠标事件、键盘事件、系统事件'APP_ICON...原创 2019-06-10 04:08:44 · 991 阅读 · 0 评论 -
wxPython 菜单栏 工具栏 状态栏
# -*- coding: utf-8 -*-"""Created on Mon Jun 10 03:56:09 2019QQ群:476842922(欢迎加群讨论学习)@author: Administrator"""#-*- coding: utf-8 -*-import wximport win32apiimport sys, osAPP_TITLE = u'菜单、工具...原创 2019-06-10 04:20:10 · 768 阅读 · 0 评论