我正在处理一个数据集,该数据集具有我想用作唯一标识的用户社会安全号(没有破折号),但想要散列(md5)字符串以便保护用户的身份。这是该数据集的样本:Python中的哈希字符串
id | date | sale_id
543875600 2014-03-22 a4395
想输出看起来像这样或类似:
id | date | sale_id
762be25b5c6eb20dd6c791840c01aa33 2014-03-22 a4395
我想用Python作为我目前使用python与解决数据汇总许多文件的目录内,因此这将是额外的代码,我将包括以下代码:
import glob
files = glob.glob('*.csv')
output="combined.csv"
with open(output, 'w') as result:
for thefile in files:
f = [open(thefile).read()]
for line in f:
result.write(line)
message = 'file created'
print (message)
哈希代码:https://docs.python.org/2/library/hashlib.html – 2015-03-13 11:07:31
也许最好是使用一些散列函数来保护用户的身份。 – Zlopez 2015-03-13 11:07:50
你的问题是什么? – mkrieger1 2015-03-13 13:45:39