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
The 'not' operator returns True if the string is empty and False if it is not. ... In Python, you can check if a string is empty by using the 'not' operator as shown in the code above.
🌐
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 - So, we can use this for checking if a string is empty or not. ... The string is empty. Explanation: "not s" negates the boolean value of s, if it's empty then it's boolean quivalent to False and its negation would be True.
🌐
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.strip() == "": print("my_string is an empty string!") else: print("my_string is not an empty string!") Sentry BlogPython Performance Testing: A Comprehensive Guide (opens in a new tab) Syntax.fmListen to the Syntax Podcast (opens ...
🌐
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?
Let's look at the following example, where we are going to use the basic way to check whether the string is empty or not. 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 ...
🌐
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 - We'll use an or operator to check both conditions at once: s = "" # Try also with s = None if s is None or s == "": print("String is empty or None") else: print("String is not empty and not None") Advice: Find out more about the or operator in Python by reading our "Guide to the Python or Operator".
🌐
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. # Using __eq__() first="" if ""__.eq__(first): print("Empty string") else: print("Not empty string") # Output: # Empty string · Finally, let’s use the python list comprehension to check if the string is empty or not.
Find elsewhere
🌐
Squash
squash.io › how-to-check-for-an-empty-string-in-python
How to Check for an Empty String in Python
We use an if-else statement with the not operator to check if string is empty. If it is, we print "The string is empty"; otherwise, we print "The string is not empty". Related Article: Python Command Line Arguments: How to Use Them
🌐
Quora
quora.com › How-do-I-check-if-the-string-is-empty-in-Python
How to check if the string is empty in Python - Quora
To check if a string is empty in Python, you can simply use an if statement. Just check the string directly. If it's empty, it evaluates to False.
🌐
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 - To get semantics out of the way, ... Pythonic, way of checking if a string is empty in Python is to simply use an if-else block with the not keyword....
🌐
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 - Let’s delve into this technique with a concise Python code example: my_string = "" if len(my_string) == 0: print("The string is empty") else: print("The string is not empty") The check for emptiness we use the character count.
🌐
Syntax Scenarios
syntaxscenarios.com › python › check-if-a-string-is-empty
How to Check if a String is Empty in Python? – Syntax Scenarios
An empty string is considered False in Python. This allows you to directly check if a string is empty by simply evaluating its truth value using the not 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 - Be it the len() method or the not operator where it considers the whitespace as an element of the string. As strings in Python cannot be modified once they’re created, hence it is useful to check if a string is empty or not.
🌐
GeeksforGeeks
geeksforgeeks.org › python › how-to-check-if-a-string-is-empty-or-contains-whitespaces-in-python
How to Check If a String is Empty or Contains Whitespaces in Python - GeeksforGeeks
July 23, 2025 - If we only want to check if a string contains spaces (and nothing else), we can use the isspace() method. This method returns True if the string contains only whitespace characters.
🌐
Python Examples
pythonexamples.org › python-check-if-string-is-empty
Python - How to check if string is Empty?
To check if given string is empty, you can either use the string variable as a condition along with NOT logical operator, or compare the given string with an empty string "" using Equal-to comparison operator.
🌐
TestMu AI Community
community.testmuai.com › ask a question
What’s the cleanest way to do a python check if string is empty? - TestMu AI Community
July 3, 2025 - I’m trying to figure out the most Pythonic way to handle a python check if string is empty. Right now, I’m doing this: if my_string == “”: It works, but I’m wondering if there’s a more elegant or built-in way, somethi…
🌐
Wyzant
wyzant.com › resources › ask an expert
Most elegant way to check if the string is empty in Python? | Wyzant Ask An Expert
May 22, 2019 - Python's developers chose to make the truthiness property of strings a function of their length. Taking bool() on a zero-length string evaluates to False. The empty string is the only possible zero-length string. All other strings return True. An if statement in Python must have a Boolean argument.
🌐
Studytonight
studytonight.com › post › how-to-check-for-an-empty-string
How to check if string is empty in Python? - Studytonight
May 3, 2023 - It is denoted by two quotes with nothing in between them: "". You can check if a string is empty in Python using the not operator, which returns True if the string is empty and False otherwise.