일반 표준 라이브러리 모듈

3359 단어 이론 노트
#!/usr/bin/env python3
# _ * _ coding:utf-8 _*_
# Date: 2019/8/5 14:32
# Author:BY
# Version:1.0

#   re  #
"""
import re
string = "by:123434:man:13023210321"
# res_obj = re. compile("\d+\w")
res_obj = re.compile("^\d{3}$")
print(res_obj.findall(string))  #   ,    
result = res_obj.match("1234")  #         ,       ,match      
re.search()      #   ,              
re.sub("  ","    ","      ")
re.split()  #         
print(result.group()if result else "      ")
"""

#    sys   #  (sys       Python    ,        Python         )
# import sys
# # print(sys.version)
# # print(sys.version_info[2])
# print(sys.path)  #                    
# print(sys.path.append()) #             
# print(sys.argv)  #        
# sys.exit() #             



#    random (     ) #
# import random
# print(random.random())
# print(random.randint(1,100)) # 1-100        
# print(random.randrange(1,10,3)) # 1-10    3
# print(random.choices(["a","b","c","d"]))


#     hashlib  #
# import hashlib
# md5 = hashlib.md5('a'.encode()) #   md5             (sha  ,byt64 )
# print(md5.hexdigest())
#       
# def md5_password(msg):
#     md5 = hashlib.md5(bytes(msg,encoding="utf-8"))
#     return md5.hexdigest()
# print(md5_password((md5_password("123"))))


#    json #
#         
# object ->     
# str ->     
# import json
# dic = { "name":11,
#         "age":12
#                   }
# with open("my.json","w",encoding="utf-8")as f:


## import pickle #   json    ¥¥

## os     ##     ,      (python         )
import os
from os import path
# dir        
# print(dir(os))
# os.system("shutdown -s") #   window    
# print(os.listdir(r"D:\\")) #             
# print(os.sep)   #         
# print(os.linesep) #         
# print(os.getcwd())  #          

# def os_demo():
#     dirs = os.popen("dir").read(r"D:\\")
#     print(dirs)
#     dirs_info = os.scandir()
#     for info in dirs_info:
#         print("   : {},  :{}, inode: {},    {},  ?{},  ?{}".format(info.name,
#              info.path, info.inode(),info.is_dir(),info.is_file(), info.is_symlink()))
#         stats = info.stat()
#         print(">>>     :{},     :{},       :{},  : {}".format(stats.st_atime,
#         start.st_ctime,stats.st_atime,stats.st_size))
# import signal
# paths = [r'file.txt', r"/python/lib/hello.py", r"/python/local/text.txt", "C:/python/local", "C:/python/file.txt"]
# strs = os.path.abspath(paths[0])
# strs1 = os.path.abspath(paths[1])
# strs2= os.path.abspath(paths[2])
# strs3 = os.path.abspath(paths[3])
# print(strs)
# print(strs1)
# print(strs2)
# print(strs3)



# import random
# def qiu_qiu():
#     one = random.randint(1, 33)
#     one1 = random.randint(1, 33)
#     one2 = random.randint(1, 33)
#     one3 = random.randint(1, 33)
#     one4 = random.randint(1, 33)
#     one5 = random.randint(1, 33)
#     one7 = random.randint(1, 16)
#     if one != one1 != one2 != one3 != one4 != one5:
#         lis = [one, one1, one2, one3, one4, one5]
#         s = sorted(lis)
#         lis_1 = [s,one7]
#     else:
#         qiu_qiu()
#     return lis_1
#
#
# print(qiu_qiu())

좋은 웹페이지 즐겨찾기