0

I try to print my table in telegram bot.

print in vs code

Due to the large distance between the columns on the phone, it looks terrible, not like a table enter image description here

Code:

table = PrettyTable()
table.set_style(PLAIN_COLUMNS )
table.hrules=ALL
table.field_names = ['Станция', 'AQI','Качество ']
for k,v in dct.items():
    table.add_row([k,v[0],v[1]])

@bot.message_handler(commands=['start'])
def start(message):
    bot.send_message(message.chat.id, f'<pre>{table}</pre>', parse_mode='html')
    
bot.polling(none_stop=True)

I use prettytable, how i can change distance between columns? I try to use table._max_width, but this is not what is needed, the distance is still large. Are there other ways to display data in a tabular format or change format with someone prettytable methods for tg bot?

Kirysha
  • 25
  • 6

0 Answers0