Python一键FTP传文件
每天下班前都需要将工作文档上传到FTP服务器,得写好文档后再打开FTP软件->登录->找到要传的文件->上传->关闭软件。久了难免会不烦,反正文档名和上传位置是固定不变,还是把Python拿出来发挥一下它的神威吧。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 #!/usr/bin/env python #coding:utf-8 from ftplib import FTP ftp = FTP(’server_name_or_ip’) print ftp.getwelcome() print ftp.login() ftp.cwd(’Pub/\xd1\xd0\xbe\xbf\xcb\xf9\xb9\xa4\xd7\xf7\xc8\xcb\xd4\xb1\xb9\xa4\xd7\xf7\xd6\xdc\xd6\xbe’) print ‘\xb8\xfc\xd0\xc2\xc4\xbf\xc2\xbc\xb4\xe6\xd4\xda\xce\xc4\xbc\xfe\xce\xaa\xa3\xba’ print ftp.dir() filename = ‘\xd1\xd0\xbe\xbf\xcb\xf9\xd6\xdc\xb9\xa4\xd7\xf7\xbf\xbc\xba\xcb.doc’ bufsize = 1024 ftp.storbinary(’stor ‘+filename,open(filename,’rb’),bufsize) ftp.set_debuglevel(0) print ‘\xb8\xfc\xd0\xc2\xc4\xbf\xc2\xbc\xba\xf3\xa3\xba’ print ftp.dir() ftp.quit() ftp.close() print [...]
Project Euler Python解题汇总 005 ~ 010
What is Project Euler? Project Euler is a series of challenging mathematical/computer programming problems that will require more than just mathematical insights to solve. Although mathematics will help you arrive at elegant and efficient methods, the use of a computer and programming skills will be required to solve most problems. The motivation for starting Project [...]

