zoukankan      html  css  js  c++  java
  • x01.polls: 学习 django

    开发一个 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) 
    批量修改文件
  • 相关阅读:
    火焰图&perf命令
    C10K问题
    cocosStudio中使用PageView,ListView和ScrollView
    vim基本命令
    Git命令学习总结(-)
    可在 html5 游戏中使用的 js 工具库
    待飞日记(第十一篇)
    待飞日记(第十篇)
    待飞日记(第八天和第九天)
    高质量C++/C编程指南
  • 原文地址:https://www.cnblogs.com/china_x01/p/6622620.html
Copyright © 2011-2022 走看看