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 8651337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T14:02:32+00:00 2026-06-12T14:02:32+00:00

I am trying to read a bunch of data in .csv file into an

  • 0

I am trying to read a bunch of data in .csv file into an array in format:
[ [a,b,c,d], [e,f,g,h], …]

Running the code below, when I print an entry with a space (‘ ‘) the way I’m accessing the element isn’t correct because it stops at the first space (‘ ‘).
For example if Business, Fast Company, Youtube, fastcompany is the 10th entry…when I print the below I get on separate lines:
Business,Fast
Company,YouTube,FastCompany

Any advice on how to get as the result: [ [a,b,c,d], [Business, Fast Company, Youtube, fastcompany], [e,f,g,h], …]?

import csv

partners = []
partner_dict = {}
i=9
with open('partners.csv', 'rb') as csvfile:
    spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
    for row in spamreader:
        partners.append(row)

    print len(partners)

    for entry in partners[i]:
        print entry
  • 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-06-12T14:02:33+00:00Added an answer on June 12, 2026 at 2:02 pm

    The delimiter argument specifies which character to use to split each row of the file into separate values. Since you’re passing ‘ ‘ (a space), the reader is splitting on spaces.

    If this is really a comma-separated file, use ‘,’ as the delimiter (or just leave the delimiter argument out and it will default to ‘,’).

    Also, the pipe character is an unusual value for the quote character. Is it really true that your input file contains pipes in place of quotes? The sample data you supplied contains neither pipes nor quotes.

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

Sidebar

Related Questions

I'm trying to read a JSON file into a data structure so that I
Trying to read headers for a csv file with: reader = csv.DictReader(open(PATH_FILE),skipinitialspace=True) headers =
I am trying to read from a file and encrypt the data using AES
Iam trying to read a binary file to memory and pass the starting address
I am trying to read in an XML file that I have saved to
I am trying to read some XML code from a website, and am having
I have a code as such that reads in an xml file into a
I'm trying to read the contents of a bunch of javascript files on a
I have a bunch of files (almost 100) which contain data of the format:
I have a flat file that I'm trying to scrub for import into a

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.