【发布时间】:2020-09-26 09:59:47
【问题描述】:
我正在 Telegram 上做一个关于公交车时间的项目,但 Python 打印的小时数以 0 结尾而没有 0,例如 10.10 变为 10.1。
if len(htp) > 0: # if the list contains at least one time
alert3 = "I prossimi pullman sono alle: "
orari_ufficiosi = []
for rfd in htp: # for each timetable
if allhd[allh.index(str(rfd))] != "0": # if the destination stop has that line
orari_ufficiosi.append(rfd)
bot.api.call('sendMessage', {
'chat_id': chat_id,
'text': alert3 + str(",\n ".join(map(str,orari_ufficiosi)))
})
问题可见here。
【问题讨论】:
标签: python string format rounding