Condition if column from table is empty is not working?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I want to make a loop where if a column is empty in a row to do something else. The problem is that it can't determine the empty row. I tried as null, na , '',' ' and with double quotes and nothing.



for i in t_list:
with arcpy.da.SearchCursor(i, ["name","num"]) as cur:
for row in cur:
if row[1] is not "''":
print(row)


Gives:



nog1, num = '1'
nog2, ''


And it returns even the the empty rows










share|improve this question









New contributor




user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.























    up vote
    1
    down vote

    favorite












    I want to make a loop where if a column is empty in a row to do something else. The problem is that it can't determine the empty row. I tried as null, na , '',' ' and with double quotes and nothing.



    for i in t_list:
    with arcpy.da.SearchCursor(i, ["name","num"]) as cur:
    for row in cur:
    if row[1] is not "''":
    print(row)


    Gives:



    nog1, num = '1'
    nog2, ''


    And it returns even the the empty rows










    share|improve this question









    New contributor




    user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.





















      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I want to make a loop where if a column is empty in a row to do something else. The problem is that it can't determine the empty row. I tried as null, na , '',' ' and with double quotes and nothing.



      for i in t_list:
      with arcpy.da.SearchCursor(i, ["name","num"]) as cur:
      for row in cur:
      if row[1] is not "''":
      print(row)


      Gives:



      nog1, num = '1'
      nog2, ''


      And it returns even the the empty rows










      share|improve this question









      New contributor




      user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      I want to make a loop where if a column is empty in a row to do something else. The problem is that it can't determine the empty row. I tried as null, na , '',' ' and with double quotes and nothing.



      for i in t_list:
      with arcpy.da.SearchCursor(i, ["name","num"]) as cur:
      for row in cur:
      if row[1] is not "''":
      print(row)


      Gives:



      nog1, num = '1'
      nog2, ''


      And it returns even the the empty rows







      arcpy cursor null






      share|improve this question









      New contributor




      user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 1 hour ago









      PolyGeo♦

      52.2k1779236




      52.2k1779236






      New contributor




      user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 1 hour ago









      user51332

      82




      82




      New contributor




      user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user51332 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          3
          down vote



          accepted










          To check for not na/none use:



          if row[1] is not None


          To check for both None and empty string use:



          if row[1] not in ('', None)





          share|improve this answer






















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "79"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );






            user51332 is a new contributor. Be nice, and check out our Code of Conduct.









             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f300302%2fcondition-if-column-from-table-is-empty-is-not-working%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            3
            down vote



            accepted










            To check for not na/none use:



            if row[1] is not None


            To check for both None and empty string use:



            if row[1] not in ('', None)





            share|improve this answer


























              up vote
              3
              down vote



              accepted










              To check for not na/none use:



              if row[1] is not None


              To check for both None and empty string use:



              if row[1] not in ('', None)





              share|improve this answer
























                up vote
                3
                down vote



                accepted







                up vote
                3
                down vote



                accepted






                To check for not na/none use:



                if row[1] is not None


                To check for both None and empty string use:



                if row[1] not in ('', None)





                share|improve this answer














                To check for not na/none use:



                if row[1] is not None


                To check for both None and empty string use:



                if row[1] not in ('', None)






                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited 1 hour ago

























                answered 1 hour ago









                BERA

                12.6k51737




                12.6k51737




















                    user51332 is a new contributor. Be nice, and check out our Code of Conduct.









                     

                    draft saved


                    draft discarded


















                    user51332 is a new contributor. Be nice, and check out our Code of Conduct.












                    user51332 is a new contributor. Be nice, and check out our Code of Conduct.











                    user51332 is a new contributor. Be nice, and check out our Code of Conduct.













                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f300302%2fcondition-if-column-from-table-is-empty-is-not-working%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Comments

                    Popular posts from this blog

                    What does second last employer means? [closed]

                    List of Gilmore Girls characters

                    Confectionery