Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 877475
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T11:36:56+00:00 2026-05-15T11:36:56+00:00

I have a comma separated value table that I want to read in Python.

  • 0

I have a comma separated value table that I want to read in Python. What I need to do is first tell Python not to skip the first row because that contains the headers. Then I need to tell it to read in the data as a list and not a string because I need to build an array out of the data and the first column is non-integer (row headers).

There are a total of 11 columns and 5 rows.
Here is the format of the table (except there are no row spaces):

col1,col2,col3,col4,col5,col6,col7,col8,col9,col10,col11

w0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10        
w1  1, 2, 3, 4, 5, 6, 7, 8, 9, 10    
w2  1, 2, 3, 4, 5, 6, 7, 8, 9, 10   
w3  1, 2, 3, 4, 5, 6, 7, 8, 9, 10 

Is there a way to do this? Any help is greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T11:36:57+00:00Added an answer on May 15, 2026 at 11:36 am

    You can use the csv module for this sort of thing. It will read in each row as a list of strings representing the different fields.

    How exactly you’d want to use it depends on how you’re going to process the data afterwards, but you might consider making a Reader object (from the csv.reader() function), calling next() on it once to get the first row, i.e. the headers, and then iterating over the remaining lines in a for loop.

    r = csv.reader(...)
    headers = r.next()
    for fields in r:
        # do stuff
    

    If you’re going to wind up putting the fields into a dict, you’d use DictReader instead (and that class will automatically take the field names from the first row, so you can just construct it an use it in a loop).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 496k
  • Answers 496k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I figured it out by looking at the Circ sample… May 16, 2026 at 11:40 am
  • Editorial Team
    Editorial Team added an answer You can always check the documentation, it's linked from the… May 16, 2026 at 11:40 am
  • Editorial Team
    Editorial Team added an answer I'm a little confused by your description, but when you… May 16, 2026 at 11:40 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

Environment: SQL Server 2005 I have a stored proc which receives comma separated value
In a certain TABLE, I have a VARTEXT field which includes comma-separated values of
I have a list of record Id's that I want to retrieve from Sql
In my properties file I have one property, which contains a comma separated list
I have to maintain an application that has a lot of columns that are
Say if I have an array and I want to check if an element
Possible Duplicate: How can I declare a thousand separator in read.csv? I actually have
I have a table with 2 columns, date and score. It has at most
I'm trying to take the user input, which may or may not have a
I have a result set from a DB that returns the following array.... how

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.