Python的妙用,不解释

import base64

filelist = [
    'TeamTalk.hta',
    'teamtalk.js',
    'util.js',
    'config.js'
]

for filename in filelist:
    print 'encoding filename'
    f1 = open(filename, 'r')
    f2 = open(filename + '.b64', 'w')
    f2.write(base64.b64encode(f1.read()))
    f2.close()
    f1.close()

print 'done'
 

你可能感兴趣的:(python)