Python: webserver 轉碼 寄信

Posted by tjwei on 星期四, 3月 03, 2005 with No comments


Webserver
python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"


寄信
simplemapi.SendMail("xxx@gmail.com","title","body text","attachment")


列出目錄下面的檔案並且照檔案修改時間順序排列
l=os.listdir(".")
l.sort(key=lambda x:os.stat(x).st_mtime)


轉碼 (utf-8 到 big5)
python -c "import sys; \
sys.stdout.write(sys.stdin.read().decode('utf-8').encode('big5'))"


Categories: ,