-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
导入Python模块的方式
import math #导入math包
print(math.sin(1.23))
from math import cos,tan #仅导入math包中的cos和tan
#直接使用cos函数,不用再加`math.`了,
#如果还加`math.`就会抛出异常 `NameError: name 'math' is not defined`
print(cos(2.34))
print(tan(1.23))
from math import * #导入math包中全部函数
#直接使用cos函数,不用再加`math.`了
#如果还加`math.`就会抛出异常 `NameError: name 'math' is not defined`
print(cos(2.34))
print(tanh(1.23))