「Python入門」複数の戻り値を返すサンプル

関数
def cftfunc():
return “pqm”, 77

結果
kdf = cftfunc()
print(type(kdf)) # <type ‘tuple’>
print(kdf) # (‘pqm’, 77)
print(kdf[0]) # ‘pqm’
print(kdf[1]) # 77

Comments are closed.