Empty strings are "falsy" (python 2 or python 3 reference), which means they are considered false in a Boolean context, so you can just do this:

if not myString:

This is the preferred way if you know that your variable is a string. If your variable could also be some other type then you should use:

if myString == "":

See the documentation on Truth Value Testing for other values that are false in Boolean contexts.

Answer from Andrew Clark on Stack Overflow
🌐
PythonHow
pythonhow.com › how › check-if-a-string-is-empty
Here is how to check if a string is empty in Python
my_string = "" if len(my_string) == 0: print("String is empty.")Another alternative would be to use the bool() function. This will check if the string is empty or not, returning True if it's empty and False if it's not.
🌐
Sentry
sentry.io › sentry answers › python › check if a string is empty in python
Check if a string is empty in Python | Sentry
if my_string == "": print("my_string is an empty string!") else: print("my_string is not an empty string!")
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › check if string is empty or not in python
Check if String is Empty or Not in Python - Spark By {Examples}
May 21, 2024 - The __eq__() method is a special method, it is one of the so-called “dunder” methods (short for “double underscore”), which are special methods in Python that have a particular syntax, beginning and ending with two underscores.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-program-to-check-if-string-is-empty-or-not
Check if String is Empty or Not - Python - GeeksforGeeks
July 11, 2025 - Explanation: A simple equality check (s == "") determines if the string is empty. The len() function returns the length of a string so if the length is 0, it means that string is empty: ... The string is empty.
🌐
Python Pool
pythonpool.com › home › blog › 7 quick ways to check if string is empty in python
7 Quick Ways to Check If String is Empty in Python - Python Pool
May 4, 2023 - #input empty with and without spaces string s = "" str = " " x = len(s) y = len(str) if x == 0: print("string is empty") else: print("string is not empty") if y == 0: print("string is empty") else: print("string is not empty") ... Here, we have ...
🌐
Enterprise DNA
blog.enterprisedna.co › python-empty-string
Python Empty String: Explained With Examples – Master Data Skills + AI
You have several choices for identifying an empty string with Python code. Here are the three simplest ways: ... You can compare a string variable with a quoted empty string using the eq operator to check for equality.
Find elsewhere
🌐
Syntax Scenarios
syntaxscenarios.com › python › check-if-a-string-is-empty
How to Check if a String is Empty in Python? – Syntax Scenarios
Another straightforward method to check for an empty string is by comparing it with "". It explicitly shows what you are checking for. A string is treated as empty if it is the same as "". ... In this example, the program compares str_text with an empty string using the equality operator ==. Since ...
🌐
Python Examples
pythonexamples.org › python-check-if-string-is-empty
Python - How to check if string is Empty?
Python - Check if String is Empty - To check if given string is empty, you can either use the string variable as is inplace a condition along with not operator, or verify if the string equals empty string "" using equal to operator.
🌐
Scaler
scaler.com › home › topics › program to check if string is empty in python
Program to Check if String is Empty in Python - Scaler Topics
January 11, 2023 - We can either use the not operator ... the equal operator to match with an empty string. Only strings which no whitespaces are considered empty while we implement the not operator and hence it gets evaluated to TRUE.
🌐
Esri Community
community.esri.com › t5 › python-questions › quot-if-not-null-and-not-empty-string-quot-paradox › td-p › 1618009
Solved: "If not Null and not empty string" paradox - help ... - Esri Community
May 29, 2025 - Your original logic is also evaluating to True if the sate is both None and not an empty string (which is always True) ... From both a practice ( https://peps.python.org/pep-0008/ ) and performance perspective, checking for None should be done using "is" or "is not".
🌐
Python.org
discuss.python.org › python help
.Empty string comprehension? - Python Help - Discussions on Python.org
March 14, 2020 - Hello everyone , I wrote this code ... string , but we when set age as a number ( age = 4 ) no error happens , when we say if age = True , that means age is not an empty string , ......
🌐
Tutor Python
tutorpython.com › check-if-string-is-empty-in-python
How to Handle or Check if String is empty in Python
December 25, 2023 - One of the most straightforward ways to check if a string is empty is by directly comparing it with an empty string using the equality (==) operator. my_string = "Hello, World!" if my_string == "": print("The string is empty") else: print("The ...
🌐
TutorialsPoint
tutorialspoint.com › what-is-the-most-elegant-way-to-check-if-the-string-is-empty-in-python
What is the most elegant way to check if the string is empty in Python?
str1 = "" if not str1: print("It Is Empty.") else: print("It Is Not Empty.") ... The string is empty. The Python len() function is used to determine the length of an object (such as list, string or dictionary).
🌐
datagy
datagy.io › home › python posts › python strings › how to check if a string is empty in python
How to Check if a String is Empty in Python • datagy
December 16, 2022 - The simplest, and most Pythonic, way of checking if a string is empty in Python is to simply use an if-else block with the not keyword.
🌐
Stack Abuse
stackabuse.com › how-to-check-if-a-string-is-empty-or-none-in-python
How to Check if a String is Empty or None in Python
June 5, 2023 - In this example, the if statement checks two conditions: if s is None and if s is an empty string. If either condition is true, it will print "String is empty or None". If both conditions are false (meaning the string is not None and it's not empty), it will print "String is not empty and not None". Python has two equality operators, == and is.