def pretty_print(stations, search=None):
from terminaltables import AsciiTable
datas = [['S.N.', 'NAME', 'LOCATION', 'FREQUENCY'],]
for counter, station in enumerate(stations):
if search and search in station['name'] or not search:
datas.append([counter + 1, station['name'], station['location'], station['frequency']])
table = AsciiTable(datas)
print(table.table)
评论列表
文章目录