Tilo Mitra's avatar

文件的上传校验

使用线程池开多线程会出错服务端.pyimport hashlibimport randomimport socketserverimport structimport jsonimport osimport threadingfrom configparser import ConfigParserclass Myserver(socketserver.BaseRequestHandler): def get_md5(self, file_size, file_path): md = hashlib.md5() read_size = 0 ...

Tilo Mitra's avatar

python文件打包

下载pyinstallerpip install pyinstaller最后,打包文件D:\>pyinstaller -F run.py #文件的绝对路径

Tilo Mitra's avatar

字体颜色

红色显示print("\u001b[31m hello world!")背景颜色显示print("\u001b[42;37;5m hello world!")重置属性设置print("\u001b[34;1m hello world! \u001b[0m") print("\u001b[41;37m hello \u001b[0m \u001b[32;4m world! \u001b[0m")颜色集for i in range(0, 16): line = "" for j in range(0, 16): code = str(i * 16 + j) ...

Tilo Mitra's avatar

liunx的awk取地址命令

ip add |grep eth0|awk 'NR==2{print $2}'

Tilo Mitra's avatar

liunx的vim命令

文字替换列如替换文件的root为alex:%s/root/alex/g

Tilo Mitra's avatar

liunx命令

刷选当前目录的文件ll -R |grep ^-

Tilo Mitra's avatar

IndentationError: expected an indented block 错误

IndentationError: expected an indented block是缩进错误使用pyCharm格式化code >> Reformat Code或者使用快捷键Ctrl + Alt + L

Tilo Mitra's avatar

python设置配置文件

创建配置文件system.conf[client]ip = 127.0.0.1port = 8000dir = E:\\文件目录\\mkdir = 我的目录thread = 2[server]ip = 127.0.0.1port = 8000dirs = E:\\主文件写入from configparser import ConfigParsercp = ConfigParser()cp.read('system.conf',encoding="utf-8")mkdir = cp.get("client",'mkdir')ip = cp.get("client",'ip')port = ...

Tilo Mitra's avatar

socketserve文件发送

服务端import socketserverimport structimport jsonclass Myserver(socketserver.BaseRequestHandler): def handle(self): # server = socket.socket() # server.bind(('127.0.0.1',8000)) # server .listen(5) # conn,addr = server.accept() obj = self.request.recv(4) h...

  上一页 下一页  

湘ICP备19016894号 © 2019 小钱