Skip to content

Python declare Empty String | Example code

  • by

Use “” to declare an empty string in Python. You can use characters inside a single quote(”) or double quotes (“”).

empty_string = ""

How to declare an empty string in Python Example

Assign “” to a variable to initialize an empty string. And in example check if String is empty in Python.

empty_string = ""

# Check empty or not
if not empty_string:
    print("Empty String")

Output:

Python declare Empty String

Do comment if you have any questions or suggestions on this Python string topic.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading