Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------------
- fornecedores_ce.csv
- ---------------------------------------------------------
- cnpj;razao_social;nome_fantasia;cpf;uf;municipio;telefone;email;excluido
- 07816912000185;1AARON COMERCIO DE INSTALACOES COMERCIAIS E ESCRITORIO LTDA - ME;KIUBA;;CE;Fortaleza;;;false
- 13056090000184;2 K CONSTRUCOES E SERVICOS EIRELI - EPP;2 K CONSTRUCOES ELETRIFICACAO E SERVICOS LTDA.;;CE;Boa Viagem;;;false
- 07656795000130;2A CONSTRUCOES LTDA;;;CE;Fortaleza;;;false
- ---------------------------------------------------------
- test.py
- ---------------------------------------------------------
- import csv
- pathfile = os.path.dirname(os.path.abspath(__file__))+'/'+'fornecedores_ce.csv'
- with open(pathfile, mode='r', encoding="UTF-8") as csv_file:
- csv_reader = csv.DictReader(csv_file, delimiter=';')
- line_count = 1
- for row in csv_reader:
- if line_count > 1:
- razao_social = row['razao_social']
- nome_fantasia = row['nome_fantasia']
- cnpj = row['cnpj']
- cpf = row['cpf']
- uf = row['uf']
- municipio = row['municipio']
- telefone = row['telefone']
- email = row['email']
- thislist.append(DDL(sql_insert_pj(razao_social, nome_fantasia, cnpj, cpf, uf, municipio, telefone, email)))
Add Comment
Please, Sign In to add comment