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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T22:43:13+00:00 2026-05-13T22:43:13+00:00

I have a CSV file and I am running a script against it to

  • 0

I have a CSV file and I am running a script against it to insert into a database.
If the value is blank then I don’t want to insert it. Here is what I have

if attrs[attr] != '' and attrs[attr] != None:
            log.info('Attriute ID: %s' % attr)
            log.info('Attriute Value: %s' % attrs[attr])
            sql = insert_attr_query(attrs[attr], object_id, attr)
            cursor.execute(sql)

It’s blank and it doesn’t = ” or None, then wth does it =?

  • 1 1 Answer
  • 2 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-13T22:43:13+00:00Added an answer on May 13, 2026 at 10:43 pm

    It’s probably whitespace i.e. a tab or string with spaces try:-

    attrs[attr].strip()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm running an import script which imports a CSV dump of a database into
I have CSV file and Macro in VBA. I want to open CSV file
i have csv files, java app and database, i read csv file from my
I have a csv file, and I want to extract the each column a
I'm trying to upload a 95 GB CSV file into a MySQL database (MySQL
I have imported a csv file containing spatial area information in varchar, then converted
I have a very large .csv file, and I'm loading it into mysql with
Ok, running into a problem with pulling a Zip code from a CSV file
I have a csv file like, let's say table.csv foo;3 bar;1 and a script
I have a PHP CLI script, that processes a csv file, inserting it's content

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.