Learn Python Easy Way
Thursday, February 18, 2016
using import in class
class C:
os = __import__('sys')
def f(self):
print self.os.platform
c = C()
c.f()
Link:
http://stackoverflow.com/questions/6861487/importing-modules-inside-python-class
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment