converter n'écrase plus
This commit is contained in:
parent
0026f5bc86
commit
8eb2e3e21d
1 changed files with 11 additions and 2 deletions
13
converter.py
13
converter.py
|
@ -1,6 +1,9 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import json
|
||||
import glob
|
||||
import os
|
||||
import os,sys
|
||||
# Basic converter to json, avec roles nounous partout
|
||||
|
||||
init_path = '/home/dstan/crans/passwords/'
|
||||
|
@ -12,7 +15,13 @@ filenames = glob.glob('*.asc')
|
|||
|
||||
encoder=json.JSONEncoder()
|
||||
for filename in filenames:
|
||||
nf = file(final_path+filename[:-4]+'.json','w')
|
||||
fname=final_path+filename[:-4]+'.json'
|
||||
if os.path.exists(fname):
|
||||
print "%s already exists, ignored" % filename
|
||||
continue
|
||||
else:
|
||||
print "Traitement de %s" % filename
|
||||
nf = file(fname,'w')
|
||||
|
||||
nf.write(encoder.encode({'roles':['nounous']\
|
||||
,'contents':open(filename).read()}))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue