print a table in python with grid code example

Example: python code to display a grid of data table

try:  from tkinter import *  from tkinter.ttk import *except ImportError :    print("exception in importing module")
class MyWindow(Frame):




    def CreateUI(self):        tv = Treeview(self)        tv['columns'] = ('Name', 'Mobile', 'course')        tv.heading("#0", text='RollNo', anchor='w')        tv.column("#0", anchor="w")        tv.heading('Name', text='Name')        tv.column('Name', anchor='center', width=100)        tv.heading('Mobile', text='Mobile')        tv.column('Mobile', anchor='center', width=100)        tv.heading('course', text='course')        tv.column('course', anchor='center', width=100)        tv.grid(sticky = (N,S,W,E))        self.treeview = tv        self.grid_rowconfigure(0, weight = 1)        self.grid_columnconfigure(0, weight = 1)root = Tk()MyWindow(root)root.mainloop()