Answers for "python is not null or empty"

2

python not null

test = "hello world"

if test is not None:
  print("test is not None")
  
test2 = None

if test2 is None:
  print("test2 is None")
Posted by: Guest on May-30-2021
18

check if string is empty python

my_str = ""
if not my_str:
  print("empty")
else:
  print("not empty")
#output: empty
Posted by: Guest on May-09-2020
0

python if not null

#variable
var = "hello python"

#check is not null
if var is not NaN:
    print('Var is not null')
Posted by: Guest on May-18-2021
3

how to check empty string in python

my_empty_string = ''  # given the empty string a variable

def check_empty():
    if not my_empty_string: 
        print("Empty")
    else:
        print("Not Empty")


check_empty()



# by George Kwabena
Posted by: Guest on September-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language