In Python, you can create an empty string by initializing a variable with an empty string literal or using the str() constructor without arguments.
In this example,
emptyString
and initialize it with an empty string literal ''
.emptyString
now holds an empty string.# Empty String Example
emptyString = ''
print(f'Empty string created: {emptyString}')
Empty string created:
In this example,
str()
constructor without arguments.emptyString
now holds an empty string.# Using str() Constructor
emptyString = str()
print(f'Empty string created: {emptyString}')
Empty string created:
In this tutorial, we learned How to Create an Empty String in Python language with well detailed examples.