I have a string that shows like that:
def function():
my_string = """Balabala
-
Blala2: lala
-
Blala#End
"""
All the empty lines have that invisible character (character: ⠀).
When I print that string, I get:
Balabala
-Blala2: lala
-Blala#End
The -
is an invisible character. Stackoverflow not allow that invisible character.
What python should print:
Balabala
-
Balala2: lala
-
Blala#End
Does anyone have any advice for me or a solution?
EDIT: I use that string for Instagram Image description. Instagram not allow line breaks without a character. Because of that restriction, I searched for an invisible character. Now I want to implement that invisible character in my string.
You can filter out the invisible characters with a list comprehension:
Output: