温馨提示×

python什么函数可以返回元组

九三
892
2021-02-09 09:36:08
栏目: 编程语言
Python开发者专用服务器限时活动,0元免费领,库存有限,领完即止! 点击查看>>

python什么函数可以返回元组

在python中使用format函数返回元祖,具体方法如下:

1.首先,在python中定义一个元组;

def measure():

temp = 39;

wetness = 50

trturn temp,wetness

2.元组定义好后,使用format函数即可返回元组;

def measure():

temp = 39;

wetness = 50

trturn temp,wetness

temp_1,wetenss_1 = measure()

print('temp:{}'.format(temp_1))

print('wetness:{}'.format(wetness_1))

输出结果为:

temp:39

wetness:50

亿速云「云服务器」,即开即用、新一代英特尔至强铂金CPU、三副本存储NVMe SSD云盘,价格低至29元/月。点击查看>>

推荐阅读:python的diff函数返回什么结果

0