path.dirname

print(__file__)
import os
print(os.path.dirname(__file__))

#sys.path python 默认去根据【】的路径去找模块



print(__file__)
import os
import sys
from lib.xx import aaa
print(os.path.dirname(__file__))
sys.path.append(os.path.dirname(__file__) + "/lib/xx")
for i in sys.path:
print(i)
os.path.join

md5

import hashlib
import string

hash1 = hashlib.md5()
hash1.update(bytes("123",encoding = "utf-8"))
h = hash1.hexdigest()
n = int(h,base=16)

print(n)
print(h)
print(hex(n))


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\python.exe “C:\Program Files\JetBrains\PyCharm 2017.2\helpers\pydev\pydevd.py” –multiproc –qt-support=auto –client 127.0.0.1 –port 6131 –file C:/Users/Administrator/PycharmProjects/py/md5test6.py
pydev debugger: process 5276 is connecting

Connected to pydev debugger (build 172.3757.67)
42767516990368493138776584305024125808
202cb962ac59075b964b07152d234b70
0x202cb962ac59075b964b07152d234b70

Process finished with exit code 0

正则表达式

import  re
n = re.findall("(\d+)(\w)*(\d+)","a2b3c45")
m = re.search("(\d+)(\w)*(\d+)","a2b3c45")
print(n)
print(m)


Connected to pydev debugger (build 172.3757.67)
[(‘2’, ‘4’, ‘5’)]
<_sre.SRE_Match object; span=(1, 7), match=’2b3c45′>

Process finished with exit code 0