Skip to content

Instantly share code, notes, and snippets.

View MOOOWOOO's full-sized avatar

Jux Liu MOOOWOOO

  • Chongqing, China
View GitHub Profile
@MOOOWOOO
MOOOWOOO / config.ini
Last active March 12, 2016 08:43
python发邮件
[mail]
smtp_server = smtp.your-service.com
to_addr = target@email.com
from_addr = your@email.com
nickname = nick-name
password = your-password
prefix = subject-prefix
port = 25
@MOOOWOOO
MOOOWOOO / getPathFileList.py
Last active March 12, 2016 09:24
遍历路径下的所有文件名
from os import listdir
from os.path import splitext, basename, isfile, isdir, join
def GetFileList(dir, fileList):
newDir = dir
if isfile(dir):
fileList.append(dir.decode('utf-8'))
elif isdir(dir):
for s in listdir(dir):
# 如果需要忽略某些文件夹,使用以下代码
@MOOOWOOO
MOOOWOOO / calculate.py
Last active March 11, 2016 08:05
分:秒.毫秒 的python计算方式
def calculate(last_time, current_time):
time_delta = \
datetime.datetime.strptime(current_time, '%M:%S.%f') -\
datetime.datetime.strptime(last_time, '%M:%S.%f')
return str(time_delta)[2:-4]
@MOOOWOOO
MOOOWOOO / py-lineno_funcname
Last active March 12, 2016 08:44
python 打印当前行数和所在的函数名
import sys
def get_cur_info():
_ = sys._getframe()
return (_.f_code.co_name, _.f_back.f_lineno) # funcname, lineno