Violent_Python笔记
Violent Python笔记本笔记为Python2代码。
入门抓取banner12345import socketsocket.setdefaulttimeout(2)s=socket.socket()s.connet(("192.168.95.148",21))ans=s.recv(1024)#1024B数据
UNIX口令破解机12import cryptcrypt.crypt("egg","HX")
zip口令破解机123456import zipfilezFile=zipfile.ZipFile("*.zip")try: zFile.extractall(pwd="...")except Exception,e: print e
多线程12345678910from threading import Threaddef extractFile(zFile,password): #...def main(): passFile=open(' ...
Python爬虫笔记
Python爬虫笔记urllibGET请求1234567import urllib.requesturl='https://...'response=urllib.request.urlopen(url=url)response.status #返回请求码 200response.getheaders() #返回响应头信息 [('Connection','close'),('Content-Length','48955'),('Server','nginx'),...]response.read().decode('utf-8') #返回HTML代码
POST请求123456import urllib.requestimport urllib.parseurl='...'data=bytes(urllib.parse.urlencode({'hello':'py ...
Python-OpenCV
Python-OpenCV安装1pip install opencv-contrib-python
基本操作读取+显示图像123456789101112131415161718192021import cv2image=cv2.imread('*.jpg',cv2.IMREAD_UNCHANGED)""" image=cv2.imread(filename,flags) filename 文件名 flags 默认1为彩色 0为灰度图像 cv2.IMREAD_UNCHANGED 保持原格式 可选"""cv2.imshow("flower",image)""" cv2.imshow(winname,mat) winname 窗口名称 mat 图像"""cv2.waitKey()""" retval=cv2.wait ...
Python-z3
Python-z3快速上手安装1pip install z3_solver
使用1from z3 import *
整形1234567891011n=Int('n')a,s,d=Ints('a s d')x=Solver()x.add(a-d==18)x.add(a+s==12)x.add(s-d==20)#...check=x.check()print(check)#sat有解 unsat无解model=x.model()print(model)#输出解
有理数123456789m=Real(m)x,y=Reals('x y')s=Solver()s.add(x**2+y**2==3)s.add(x**3==2)check=s.check()print(check)model=s.model()print(model)
二进制位运算12345678910m=BitVec('m',8)#8bit=1Bytex,y,z=BitVecs('x y z',8)s=Solver()s.a ...
Python-segno
Python-segno安装12pip install segnopip install qrcode-artistic
基本使用123456789101112import segnoqr_code_message='...'qr=segno.make(qr_code_message)qr.save('*.png',scale=10)""" 可选参数: border 边框大小 dark 深色部分颜色 light 浅色部分颜色 finder_dark finder部分颜色"""qr.save('*.png',dark='red',light='#562396',scale=10,border=10,finder_dark='yellow')
背景图像上创建12qrcode=segno.make('...',error= ...
Python-pyenv
Python-pyenv这玩意巨难使,建议不要尝试
安装从Github上下载源码新建系统环境变量:PYENV PYENV_ROOT PYENV_HOME 均为.../pyenv-win添加用户环境变量:.../pyenv-win/shims和 .../pyenv-win/bin打开pyenv-win\.versions-cache.xml 把https://www.python.org/ftp/python替换为https://registry.npmmirror.com/-/binary/python打开pyenv-win\libexec\libs\pyenv-install-lib.vbs 替换操作同上
命令123456789101112131415161718#查看pyenv版本,测试安装成功:pyenv --version#查看所有可安装的版本:pyenv install --list#列出已安装的所有版本:pyenv versions#安装特定版本:pyenv install 3.7.10#卸载特定版本:pyenv uninstall 3.7.10#创建shims,每次更新、 ...
Python-Tkinter
Python-Tkinter12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788from tkinter import *from tkinter.ttk import *win=Tk()win2=Toplevel() #弹出顶层窗口win.mainloop()win.title("...")#窗口标题win.geometry("300x300+0+0")#窗口大小300x300 左上角(0,0)win.geometry("300x300-0-0")#同理右下角win.configure(bg="yellow"或"#a7ea90")#窗口背景颜色win.maxsize(int,int)#窗口最大尺寸" ...
Ren'Py笔记
Ren’Py笔记1234script.rpyoptions.rpygui.rpyscreens.rpy
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162label start: ... returnmenu: "...": jump game "...": jump booklabel game: ...label book: ...default book=True$ book=Trueif book: ...else: ...say: "角色" "正在说的话" "旁白的话" #"用\" define s=Character('名字',color="#C8FFC8 ...
Python笔记
Python笔记123456789#https://www.runoob.com/python3/python3-os-file-methods.html#C:\Users\Administrator\AppData\Roaming\Python\Python37\site-packages# 命令行# pyinstaller -f -w *.ico *.py #生成.exe,加上-w表示去掉控制台# pyinstaller --paths 第三方模块路径 -F -w --icon=*.ico *.py# 资源要放在.exe目录下#生成.whl:python *.py bdist_wheel
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021 ...
Python-Pandas
Python-pandas1import pandas
文件读写通用12folder_name=os.path.dirname(__file__)file_name=os.path.join(folder_name,'*.txt')
读写.csv文件12345678910111213141516171819df=pandas.read_csv(file_name,encoding='GBK')""" read_csv常用参数: index_col:设置索引,如: index_col=0 第1列 index_col='orderDate' index_col=[0,1] index_col=['orderDate','itemNo'] sep或delimiter:二选一 sep='\t' 设置分隔符 delimiter='\t ...