>>> from time import sleep
>>> sleep(2)
>>> import time
>>> time.sleep(1)
>>> from time import *
>>> sleep(2)
>>> import time
>>> help(time)
同目录调用
test_sample
- test_21072201.py
- test_21072202.py
test_21072201.py
class MyClass():
def say_hello(self, name):
return "hello, {}".format(name)
def add(self, a: int, b: int):
return a + b
if __name__ == '__main__':
mc = MyClass()
print(mc.say_hello("haha")) --》hello, haha
print(mc.add(10, 31))
test_21072202.py
from test_21120601 import MyClass
m = MyClass()
print(m.say_hello("hihi")) --》hello, hihi
if __name__ == '__main__'