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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:47:12+00:00 2026-05-12T22:47:12+00:00

I have a set of csv headers that I am trying to match with

  • 0

I have a set of csv headers that I am trying to match with uploads. It’s not really working. Not all headers are required — I just have to match what’s in the file.

reader = csv.DictReader(open(PathFile))
headers = reader.fieldnames
for header in sorted(set(headers)):
     if (header == 'ip') or (header == 'IP'):
         print  "IP found in Header"

In this case, IP is not found.

for row in reader:
     if row.get('IP'):
         print  "IP found in Row"

It’s not found again. I did search on this site — there was:

IP = row.get('IP', None)

That did not work either.

This is the file I’m using for testing:

Email, IP, Name, City, State, zip, country, garbage
ghfddgf@gfgs.com, 34.4.34.34,Mr GH, chicago, il ,60601, us,erw ewr 
5t4g@fdsf.com, 34.45.23.34, Mr 5t,NY,NY,10101, us, er
  • 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-12T22:47:13+00:00Added an answer on May 12, 2026 at 10:47 pm

    Based on your edit, you need to skip the initial space after the comma.

    This should do it:

    >>> reader = csv.DictReader(open(PathFile),skipinitialspace=True)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a PHP script that uploads a CSV file and then saves some
I have a set of .csv files that I want to process. It would
I have a CSV file with set of records on it. While I use
I have a set of 4 massive CSV files that I need to modify.
I have this code that imports a csv file into an Access table. There
I'm trying to export my DHTMLX Grid to a CSV file. I have the
I'm working with a CSV file in python, which will have ~100,000 rows when
I have a very large data set that contains multiple groups. They all contain
I have a csv file with headers. 4 columns. I need the first 3
I have a CSV (comma separated values) file that contains student information. The column

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.