zoukankan      html  css  js  c++  java
  • python常用

     1 print(os.path.basename(__file__))                 #a.py
     2 print(os.path.dirname(os.path.abspath(__file__)))  #/tmp
     3 print(os.path.abspath(os.path.dirname(__file__)))  #同上
     4 print(os.path.abspath(__file__))                #/tmp/a.py
     5 import argparse
     6 from configobj import ConfigObj
     7 parser=argparse.ArgumentParser()
     8 parser.add_argument("-s","--src",default='src.conf',help="--src=src.conf",type=str)
     9 parser.add_argument("-d","--dest",default='dest.conf',help="--src=dest.conf",type=str)
    10 args=parser.parse_args()
    11 BASE_DIR=os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    12 sys.path.append(BASE_DIR)
    13 from conf import settings
    14 
    15 1、click模块
    16 http://click.pocoo.org/5/quickstart/#screencast-and-examples
    17 2、awesome python
    18 https://github.com/vinta/awesome-python#devops-tools
    19 3、python requests
    20 http://www.python-requests.org/en/master/
    21 4、写监控端口模块
    22 5、> /dev/null 2>&1    #去掉日志
    23 6、time.strftime("%d/%h/%Y:%H:%M",time.localtime())
    24 7、sed -n "/21/Jul/2016:12:39/,/21/Jul/2016:12:44/p" access_www.log
  • 相关阅读:
    2013总结,新的征程开始了!
    NOIP2015滚粗记
    HelloWorld!
    For the strivers ——
    【DP】最长公共子序列
    【DP】青蛙过河
    【DP+拓扑】关键子工程
    【线段树+向量】POJ 2991 Crane
    【线段树】POJ3225 Help with intervals
    【数学】test20170311
  • 原文地址:https://www.cnblogs.com/weibiao/p/6273630.html
Copyright © 2011-2022 走看看