how to get the text from a label in tkinter

l = tk.Label(text="hello, world")
print("the label is", l.cget("text"))
#Outputs: the labels is hello, world

Here is what the above code is Doing:
1. We create a label widget, and assign it to a variable l.
2. We print the value of the text option of the label.

The cget method is used to get the value of an option.