不绑定类, 不绑定对象
import time
import hashlib
class Foo:
@staticmethod
def create_id():
m = hashlib.md5()
m.update(str(time.clock()).encode('utf-8'))
return m.hexdigest()
f = Foo.create_id()
print(f)
f1 = Foo()
print(f1.create_id())
C:\Users\user\AppData\Local\Programs\Python\Python36\python.exe “C:/Users/user/PycharmProjects/hellow python/test.py”
bcebfe53d1e87c6bae706062016fdcbd
f6146f776424d97263629ccff088bca2
Process finished with exit code 0