Created
September 13, 2016 18:03
-
-
Save tilacog/b1969f073c864ecb9d24da0a0f6ba4db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import rows | |
from collections import Counter | |
base_svg = '/path/to/drawing.svg' | |
base_name = 'Fulano de Tal e Coisa' | |
participants_table = rows.import_from_csv('/path/to/pyse-participantes.csv') | |
with open(base_svg) as f: | |
svg = f.read() | |
counter = Counter() | |
for row in participants_table: | |
new_svg = svg.replace(base_name, row.nome) | |
# uniquefy filename | |
counter.update([row.email]) | |
filename = '{count}-{email}.svg'.format( | |
count=counter[row.email], | |
email=(row.cc if row.cc else row.email) | |
) | |
with open(filename, 'w') as output: | |
output.write(new_svg) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment