What attributes does python import from a module? -
i checked answers this, have question attributes imported module in python.
for example, have module temp9.py:
a=10 b=20 print('a={0}, b={1}'.format(a,b)) def t9outer(): print('in imported module') def t9inner(): print('inner function') then import module so: import temp9. if attributes of imported file using command:
list(filter(lambda x: not x.startswith('__'),dir(temp9))) i output:
['a', 'b', 't9outer'] my questions are
a,bglobal in scope oftemp9, not across modules (as above answer says), how exported?why
t9inner()not imported though enclosedt9outer(), gets imported?
the answer same both questions. defined @ module level imported; not defined @ module level not imported.
Comments
Post a Comment