解包语法**data
class Qtest:
def __init__(self,name = '', addr='', no=0):
self.name = name
self.addr = addr
self.no = no
def __str__(self):
return str(self.name)+str(self.addr)+str(self.no)
if __name__ == '__main__':
# main()
a= {'no':999,'name':'888','addr':'777'}
q = Qtest(**a)
print(q)
888777999
计算md5
import hashlib
def main():
digester = hashlib.md5()
with open('Python-3.7.3.tar.xz', 'rb') as file:
for date in iter(lambda: file.read(1024), b''):
digester.update(date)
print(digester.hexdigest())
if __name__ == '__main__':
main()