Skip to content

Instantly share code, notes, and snippets.

@marcoscastro
Created March 1, 2017 23:38
Show Gist options
  • Select an option

  • Save marcoscastro/b60f9d74cfeaa61a483988e1436adb80 to your computer and use it in GitHub Desktop.

Select an option

Save marcoscastro/b60f9d74cfeaa61a483988e1436adb80 to your computer and use it in GitHub Desktop.
Código do Sorteio Kit Microsoft
'''
Extração de dados de um arquivo CSV do Google Forms com nome,e-mail
'''
import random
pessoas = {}
with open('sorteio.csv', 'r', encoding='utf-8') as f:
lines = f.readlines()[1:]
for line in lines:
dados = line.split(',')
nome, email = dados[1], dados[2]
pessoas[email] = nome
sorteado = random.choice(list(pessoas.items()))[0]
print('Nome: %s' % pessoas[sorteado])
print('E-mail: %s' % sorteado)
@marcoscastro
Copy link
Author

marcoscastro commented Mar 2, 2017

Sorteado 1 curso:
Nome: "Elias da Silva Barroso Soares"
E-mail: "[email protected]"
Status: OK

Sorteado 1 curso:
Nome: "Johnatan Rafael Santos Lima"
E-mail: "[email protected]"
Status: OK

Sorteado Kit Microsoft:
Nome: "João Vitor Boing"
E-mail: "[email protected]"
Status: OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment