• 0
Sign in to follow this  
Wedney Lima

import csv python

Question

Tenho tentado separar as colunas de uma planilha do excel salva em csv, no entanto o programa não esta retornando as colunas separadamente. o problema é que o arquivo do excel não esta sendo salvo com as colunas separadas, o programa está reconhecendo apenas as linhas. como solucionar isso?

['Erenice Santo Santos;;5587999320116']
['Lucikleia Silva;;5587996083111']
['Auda Pereira;;5587996683884']
['Carlin Furtado;;5587999619122']
['Zenilda Martins;;5587996332506']
['Morgana Casusa;;5583996334018']
['Leonizia Moreira;;5587996216471']

import csv

with open('pasta.csv', 'r') as csv_file:
    csv_reader = csv.reader(csv_file)

    for line in csv_reader:
        print(line) #usando o este código o programa retorna a lista acima.
import csv

with open('pasta.csv', 'r') as csv_file:
    csv_reader = csv.reader(csv_file)

    for line in csv_reader:
        print(line[1]) #quero imprimir apenas a coluna com os números, mas quando uso este metodo o programa retorna um erro.

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this