示例#1
0
def check_func(a):
    ret = 0
    ret = test.func(a)
    print "input a= %d: return = %d " % (a, ret)
    if ret == a * a:
        print "OK!"
    else:
        print "NG"
示例#2
0
import test

print(test.func())
示例#3
0

matplot.hist(grades, 50)
matplot.show()


# ## Writing Own Moduels

# In[31]:


# Save this code in a test.py file
def func():
    print("This is a Function")

func()


# In[ ]:


# Create another .py file
from test import func()

func()

# Run it from Command Line


# ## Import and Direct
示例#4
0
import test
import time
import numpy as np

#a = np.array([[1.,2.],[17.,15.]])
#b = np.array([[2.,1.],[7.,5.]])
a = np.random.rand(50, 50)
a = np.float32(a)
b = np.random.rand(50, 50)
b = np.float32(a)

start = time.time()
for i in range(0, 10000):
    c = test.func(a, b)
end = time.time()
print(end - start)

start = time.time()
for i in range(0, 10000):
    d = np.matmul(a, b)
end = time.time()
print(end - start)
print(d - c)
示例#5
0
def main():
    test.func()
示例#6
0
 def test_func(self):
     from test import func
     self.assertIsNone(func('ドコドコ'))
示例#7
0
# file two.py
import test

print("top-level in two.py")
test.func()

if __name__ == "__main__":
    print("two.py is being run directly")
else:
    print("two.py is being imported into another module")
示例#8
0
import test
a, b = 100, 100
print(test.func(a,b))


from test import func
print(func(a, b))