• Python学习足迹(4)(入门篇终结)


    python种的标准库:

    sys
    sys.argv所有的参数。
    import sys
    if '-h' in sys.argv: print 'this is help\n'

    sys.exit( exitcode), sys.exit(0)

    sys.stdin, data=sys.stdin.readlines()
    sys.stdout,
    sys.stderr
    sys.platform
    sys.path,返回list

    type
    if type('abc') == types.StringType: (true)
    if type('abc') == type( '' ) (true)

    copy
    copy.copy()浅copy
    copy.deepcopy()深copy

    string
    string.split()
    >>> import string
    >>> string.split("a b c")
    ['a', 'b', 'c']
    string.atoi(str,base)
    string.atof(str)
    string.atol(str,base)
    string.upper()
    string.lower()
    string.find()找位置
    string.join()合并
    string.lstrip(), string.rstrip(), string.strip()
    string.replace()

    re正则表达式

    os
    os.environ['PATH'] ='/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/sbin/:.'
    os.name  = 'posix'
    os.getcwd()
    os.listdir('/'),列出所有的dir
    os.rename(oldfile, newfile)
    os.chmod()
    os.system('cmd'),执行命令
    os.remove()
    os.mkdir()
    os.rmdir()
    os.removedirs(),删除所有
    os.path.exists(),是否存在?
    os.path.isfile(),os.path.isdir()
    os.path.split()
    >>> os.path.split('/home/james/.vimrc')
    ('/home/james', '.vimrc')

    time
    time.time(),由Unix纪元(1970年首)到现在的秒数,UTC
    time.localtime() = (2004, 8, 8, 23, 19, 53, 6, 221, 1), 年,月,日,小时,分钟,秒,周几,今年的第几天,夏时制
    time.asctime() = 'Sun Aug  8 23:20:03 2004'
    time.sleep()中断,秒数,象C#种的thread.sleep()

    tempfile
    tempfile.mktemp()产生一个临时文件


    其他的库(日后研究)
    mutex
    signal
    socket
    thread
    threading
    zlib
    gzip
    urllib
    httplib
    ftplib
    poplib
    nntplib
    smtplib
    telnetlib
    urlparse
    socketserver
    htmllib
    xmllib
    rfc82lib
    base64
    xdrlib(RPC)
    md5
    sha
    posix
    crypt

  • 相关阅读:
    更改SQLServer实例默认字符集
    使用DMV排查数据库系统异常
    OD使用符号文件进行源码级调试问题
    申请博客园第一天
    各种mac软件地址
    第6条:理解“属性”
    提高代码质量的几个方法!52个,先罗列几个自己看
    Item2的使用
    MAC命令大全
    PV UV IP
  • 原文地址:https://www.cnblogs.com/Hacker/p/31420.html
Copyright © 2020-2023  润新知