I'm using Python 3.6.4 with Miniconda on MacOS. I'm curious about that I can use methods that belongs to re
module after I import tkinter
. For example, if I want to use a re
method without importing it:
>>> re.compile('abc')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 're' is not defined
But if I use a re
methods after importing tkinter
, it works properly, like:
>>> from tkinter import *
>>> re.compile('abc')
re.compile('abc')
So I can use re.compile()
even if I haven't done import re
. Why does it happen?
From the tkinter Source in line 39:
import re
So when you import the Module tkinter you automaticly import re with it