Pythonでの”tyep”の使い方は何ですか?
Pythonにおいて、type()はオブジェクトのタイプを取得するための組み込み関数です。
type()関数の構文は次の通りです:
type(object)
objectの場合、その種類をチェックする必要があるオブジェクトです。
type()関数の返り値は、オブジェクトのタイプを表すtypeオブジェクトです。
例:
x = 5
print(type(x)) # <class ‘int’>
y = “hello”
print(type(y)) # <class ‘str’>
z = [1, 2, 3]
print(type(z)) #
z = [1, 2, 3]
print(type(z)) #