原创 使用python打印下個月的月份
# -*- coding: UTF-8 -*- from calendar import monthrange import datetime import time import os #獲取本月年份與月份 Year = time.st
原创 python 利用psutil獲取系統的內存使用率前10的進程,CPU使用率前10的進程,系統負載,網卡流量以及每個進程的磁盤IO情況
python 利用psutil獲取系統的內存使用率前10的進程,CPU使用率前10的進程,系統負載,網卡流量以及每個進程的磁盤IO情況。 注:僅適用於 linux 系統。 #!/usr/bin/python # -*- coding: U
原创 使用python產生隨機密碼
#!/usr/bin/python # -*- coding: utf-8 -*- from random import choice import string def GenPassword(length=8,chars=st
原创 使用python刪除文件中指定包含字符串的所有行
#!/usr/bin/python # -*- coding: UTF-8 -*- import re Host_IP = "2.2.2.128" def Del_line(file_path,EASYOPS_LOCAL_IP
原创 使用python遍歷上傳本地的所有文件,包含子目錄的文件
#!/usr/bin/python # -*- coding: UTF-8 -*- import os import glob from ftplib import FTP import re Server_ip = "2.2.2.128
原创 使用python遍歷 下載FTP 的所有文件,包含子目錄的文件
#!/usr/bin/python # -*- coding: UTF-8 -*- from ftplib import FTP import os import re ftp = FTP() ftp.connect('192.168.1
原创 kafka 基本命令(較新版本的kafka)
# 指定對應的配置文件啓動 kafka-server-start.sh /hadoop/kafka/config/server.properties # -daemon 以後臺的方式啓動 kafka-server-start.sh -d
原创 關於在centos下安裝python3.7.0以上版本時報錯ModuleNotFoundError: No module named '_ctypes'的解決辦法
python3.7以上版本需要一個新的包libffi-devel,安裝此包之後再次進行編譯安裝即可。 #yum install libffi-devel -y #make install 若在安裝前移除了/usr/bin下python的文
原创 nginx+CGI+python的配置
安裝spawn-fcgi #從GitHub下載 git clone https://github.com/lighttpd/spawn-fcgi.git cd spawn-fcgi #生成configure ./autogen.sh #生
原创 python 刪除文件中的空行
#!/usr/bin/python3 # -*- coding: UTF-8 -*- def Del_line(file_path): with open(file_path,"r") as f: res = f.
原创 python 根據行號刪除文件指定的行
第一種方法: #!/usr/bin/python3 # -*- coding: UTF-8 -*- def Del_line(file_path,line_num): file = open(file_path,"r")
原创 html 通過按鈕鏈接某個頁面
<!DOCTYPE html> <html lang="zh"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>
原创 python 根據行號修改文件中指定的行
#!/usr/bin/python3 # -*- coding: UTF-8 -*- def Del_line(file_path,line_num,Contents): #file_path:文件名;line_num:行號;Cont
原创 html 框架
<!DOCTYPE html> <html lang="zh"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>
原创 html 通過一個搜索框搜索站內某個目錄下的其他html文件
<!DOCTYPE html> <html lang="zh"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>