+3 votes
3 views
in Python by (3.5k points)
Can someone tell me how to refer a null object in Python?

2 Answers

0 votes
by (2k points)
edited by

None is defined for null object in Python and use is operator to check:

>>> foo is None
True
>>> foo = 'bar'
>>> foo is None
False

0 votes
by (107k points)

It's not called null as in other languages, but None. There is always only one instance of this object, so you can check for equivalence with x is None (identity comparison) instead of x == None, if you want.

You can use the following video tutorials to clear all your doubts:-

Related questions

0 votes
1 answer
asked Sep 12, 2019 in Python by Sammy (47.8k points)
0 votes
1 answer
+2 votes
2 answers
0 votes
1 answer
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...