I'm making a CLI application for myself for tracking my budget. How can I improve this code?
#!/usr/bin/python3
def t_lines():
import os
terminal_size = os.get_terminal_size()
print("-" * terminal_size.columns)
def main():
import sqlite3 as sql
conn = sql.connect("expenses.db")
cur = conn.cursor()
cur.execute("CREATE TABLE IF NOT EXISTS expenses \
(Date TEXT DEFAULT \"x\", \
item TEXT DEFAULT \"x\", \
category TEXT DEFAULT \"x\", \
Price REAL DEFAULT 0, \
Type TEXT DEFAULT \"e\")" )
t_lines()
print("Enter in the following format")
print("Enter 0 to quit")
print("Date (dd/mmm/yy), Item, Category, Price, Type ([e]xpense/[i]ncome)")
print("Example:")
print("12/nov/18, carrot, vegetable, 15.64, e")
print("13/aug/18, salary, work, 10000, income")
t_lines()
user_input = input()
# the vals below seems unnecessary
# vals = user_input.split(',')
while user_input != "0":
vals = user_input.split(',')
if len(vals) != 5:
print("Enter correctly")
else:
cur.execute("INSERT INTO expenses \
VALUES (?, ?, ?, ?, ?)", vals)
conn.commit()
user_input = input()
conn.close()
if __name__ == '__main__':
main()