Adding unicode characters to python repl

One way to add a Unicode character to Python’s REPL is to add it as a string literal.

Suppose you had the phrase “My Spanish brown eyed girl.”

To print the phrase with a Jerusalem cross between each word you would find on the internet a Unicode character reference that gives you the number sequence in this case, U+2629.

Since join method accepts one argument lets first place our sentence in a variable.

my_girl = 'My', 'Spanish', 'brown', 'eyed', 'girl.'

print('\u2629'.join('My Spanish brown eyed girl.'))

This will output the following:

My☩Spanish☩brown☩eyed☩girl.

Leave a Reply

Your email address will not be published. Required fields are marked *