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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:15:51+00:00 2026-06-14T14:15:51+00:00

This blows my mind. What am I missing? I am trying to detect if

  • 0

This blows my mind. What am I missing?

I am trying to detect if a cell in an Excel sheet is empty or not. But none of the tests seem to work in the way I expect. I would expect that the simple “not idkt” test would detect both empty strings and None, but no… In fact, it seems like None is not detected by – well – any of the tests, because in the third row, that’s what is getting printed.

Code:

def getFromExcelSheet():
    wb = load_workbook("input.xlsx")
    idkts = [];
    idktRows = get_worksheet_as_list(wb.get_sheet_by_name('Inputs'))
    # print "Got these idkts" 
    for row in idktRows:
        # print row[0]
        idkt = str(row[2]).strip()
        filename = str(row[3]).strip()
        if idkt == None:
            print "Idkt == none"

        if idkt is None:
            print "Idkt is none"

        if idkt == u"":
            print "Idkt is ''"

        if idkt != u"":
            print "Idkt is !=''"

        if not idkt:
            print "not IDKT"

        if idkt:
            print "idkt"

        print idkt

Output

Idkt is !=''
idkt
3398041577

Idkt is !=''
idkt
3498100937

Idkt is !=''
idkt
None
  • 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-14T14:15:53+00:00Added an answer on June 14, 2026 at 2:15 pm

    idkt isn’t empty, it’s a string containing the word 'None'.
    Here’s your issue:

    idkt = str(row[2]).strip()
    

    row[2] is a None, which becomes 'None' when you call str on it.
    Try this:

    if idkt == 'None': print 'yay!'
    

    You’d be better off testing for emptiness before the string conversion:

    idkt = str(row[2]).strip() if row[2] else None
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have seen other blogs and SO questions relating to this issue but none
This blows my mind. Why does this method require an unused argument? Also, it
This may not be a actual question, but I just asked it for the
I'm turning to you folks for answers because this really blows my mind... Let
After Python Objective-C syntax blows my mind! I'm trying to create a menu that
I've seen this HTML notation on blogs but they don't mention how to use
This will blow your mind... Check out http://blue-anvil.com/jquerycurvycorners/test.html using IE Curved corners look nice
I suspect this could be something faulty with Excel (although I keep an open
I have no idea why this code does not loop as it should. My
I have been struggling to find out why this rollover is not behaving as

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.