Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 17477

Inconsistent column width when printing emojis with Tabulate

$
0
0

I am trying to print out emojis as a table using tabulate, but not getting the right alignment. How can I fix that?

emojis = [['🍌', '🥕', '🥕', '🍎', '🍌', '🍎', '🦸'],           ['🍌', '🍎', '🚫', '🚫', '🍎', '🚫', '🍎'],           ['🥑', '🍎', '🥕', '🚫', '🚫', '🥑', '🚫'],           ['🥕', '🍎', '🥑', '🚫', '🍎', '🍎', '🥕'],           ['🥕', '🍌', '🚫', '🍎', '🥕', '🥕', '🍌'],           ['🚫', '🍎', '🥕', '🥑', '🥕', '🥕', '🍌'],           ['🧛', '🥑', '🚫', '🍎', '🥕', '🚫', '🥕']]print(tabulate(emojis, tablefmt="fancy_grid"))

This is the output:

╒═══╤═══╤═══╤═══╤═══╤═══╤═══╕│🍌│🥕│🥕│🍎│🍌│🍎│🦸│├───┼───┼───┼───┼───┼───┼───┤│🍌│🍎│🚫│🚫│🍎│🚫│🍎│├───┼───┼───┼───┼───┼───┼───┤│🥑│🍎│🥕│🚫│🚫│🥑│🚫│├───┼───┼───┼───┼───┼───┼───┤│🥕│🍎│🥑│🚫│🍎│🍎│🥕│├───┼───┼───┼───┼───┼───┼───┤│🥕│🍌│🚫│🍎│🥕│🥕│🍌│├───┼───┼───┼───┼───┼───┼───┤│🚫│🍎│🥕│🥑│🥕│🥕│🍌│├───┼───┼───┼───┼───┼───┼───┤│🧛│🥑│🚫│🍎│🥕│🚫│🥕│╘═══╧═══╧═══╧═══╧═══╧═══╧═══╛

Viewing all articles
Browse latest Browse all 17477

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>