原创 re模塊

import re '''\w匹配包括下劃線在內任何字母數字字符,它相當於類[a-zA-Z0-9]\W匹配非任何字母數字字符包括下劃線在內,它相當於類[^a-zA-Z0-9]?P<>定義組裏匹配內容的key(鍵),<>裏面寫key名稱,值就

原创 python發送郵件

import smtplibfrom email.mime.text import MIMEText MailSever = "smtp.126.com"Sender = "[email protected]"Password = "xxx

原创 rest理解

轉載一篇文章:https://github.com/RockTeach/PythonCourse/blob/master/web/flask/restful.md

原创 python生成一個簡單的pdf文件

from reportlab.graphics.shapes import Drawing, Stringfrom reportlab.graphics import renderPDF d = Drawing(200, 200)s = S

原创 遞歸遍歷目錄

a = []b = []num = 0def func2(path1, treeShow):global numtreeShow += " "a = os.listdir(path1) for i in a:

原创 centos7開端口並設置selinux

if selinux is enforcing and we want to add port 943 to haproxy • semanage port -l | grep http_port_t• semanage port -a -

原创 python操作mysql數據庫

import pymysql db = pymysql.connect("192.168.3.5","root","passwd","dbname")cursor = db.cursor()sql = "select version()"t

原创 python發送短信

接口類型:互億無線觸發短信接口,支持發送驗證碼短信、訂單通知短信等。 賬戶註冊:請通過該地址開通賬戶http://sms.ihuyi.com/register.html 注意事項: (1)調試期間,請用默認的模板進行測試,默認模板詳見接口文

原创 js滾動事件

<script type="text/javascript"> window.onscroll = function() { console.log("滾動"); //打印滾動高度

原创 普通用戶tomcat無法使用80/443端口怎麼辦?

首先,使用setcap設置:setcap cap_net_bind_service+ep /usr/java/jdk1.7.0_25/bin/java 然後再啓動,報錯。報錯的原因:libjli library is being impor

原创 rrdtool生成圖像

-- coding: utf-8 -- #!/usr/bin/env python import rrdtoolimport time title = "server network traffic ("+time.strftime('%Y

原创 css導航菜單

<!DOCTYPE html><html><head><meta charset="UTF-8"><title>導航</title> 主頁<> 新聞<> 聯繫<> 關於<>