开发一个 Web 应用:x01.polls,可能比想像的还要容易一些,这完全得益于 django 框架。
1.安装 django:
sudo pip3 install django
2.阅读 django 文档
3.运行效果图如下:
的确很棒,连 search, filter 等功能都提供了。
批量修改文件扩展名及大小写的一点代码,放在此备用:
# -------------------------------- # change_files.py (c) 2017 by x01 # -------------------------------- import os def changeCase(dir, isupper): """ Change file and directory case by isupper parameter. """ files = os.listdir(dir) for f in files: path = os.path.join(dir,f) newpath = "" if (isupper): newpath = path.upper() else: newpath = path.lower() if os.path.isdir(path): os.rename(path, newpath) changeCase(path, isupper) continue os.rename(path, newpath) def changeExtName(dir, orgExtName, newExtName): """ Change file org-ext-name to new-ext-name. """ filelist=os.listdir(dir) for files in filelist: path=os.path.join(dir,files) if os.path.isdir(path): changeExtName(path, orgExtName, newExtName) continue filename=os.path.splitext(files)[0] filetype=os.path.splitext(files)[1] if (filetype != orgExtName): continue newPath=os.path.join(dir, filename + '.' + newExtName); os.rename(path,newPath)