python(1)和(1)有什么区别 [英] What's the difference between (1,) and (1) in python

查看:318
本文介绍了python(1)和(1)有什么区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如标题中所述,我发现(1)和(1,)是不同的。但是它们有什么区别?

As stated in the title, I found that (1) and (1,) are different. But what's the difference of them?

In[39]: (1) == (1,)
Out[39]: False


推荐答案

逗号使它成为一个元组。 (1)与定界符中的1相同。

The comma makes it a tuple. (1) is just the same as 1 wrapped in delimiters.

这篇关于python(1)和(1)有什么区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆