Skip to main content
Stack Overflow
  1. About
  2. For Teams

Return to Answer

added 80 characters in body
Source Link
Haifeng Zhang
  • 32.1k
  • 22
  • 95
  • 133

My test sample:

└> cat hello.py
class Hello:
 def hello(self):
 print "hello"
 
└> python -c 'from hello import Hello; h= Hello(); h.hello()'
hello
└> python -c 'import hello; h= hello.Hello(); h.hello()'
hello

You should import OfficeLights as:you can choose either import mypackage.mymodule or from mypackage.mymodule import myclass

python -c 'from lighting import OfficeLights; lights = OfficeLights(); lights.flashPurple();'

My test sample:

└> cat hello.py
class Hello:
 def hello(self):
 print "hello"
 
└> python -c 'from hello import Hello; h= Hello(); h.hello()'
hello

You should import OfficeLights as:

python -c 'from lighting import OfficeLights; lights = OfficeLights(); lights.flashPurple();'

test sample:

└> cat hello.py
class Hello:
 def hello(self):
 print "hello"
 
└> python -c 'from hello import Hello; h= Hello(); h.hello()'
hello
└> python -c 'import hello; h= hello.Hello(); h.hello()'
hello

you can choose either import mypackage.mymodule or from mypackage.mymodule import myclass

python -c 'from lighting import OfficeLights; lights = OfficeLights(); lights.flashPurple();'
Source Link
Haifeng Zhang
  • 32.1k
  • 22
  • 95
  • 133

My test sample:

└> cat hello.py
class Hello:
 def hello(self):
 print "hello"
 
└> python -c 'from hello import Hello; h= Hello(); h.hello()'
hello

You should import OfficeLights as:

python -c 'from lighting import OfficeLights; lights = OfficeLights(); lights.flashPurple();'
default

AltStyle によって変換されたページ (->オリジナル) /