欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

python怎么創(chuàng)建一個(gè)空元組

python怎么創(chuàng)建一個(gè)空元組?

在python中,我們也可以創(chuàng)建一個(gè)沒有任何元素的元組 。 使用一對(duì)圓括號(hào)()創(chuàng)建一個(gè)空元組 。

Syntax:

句法:

tuple_name = ()

Example 1:

范例1:

# Python empty tuple creation`

tuple1 = ()

# printing tuple

print("tuple1: ", tuple1)

# printing length

print("len(tuple1): ", len(tuple1))

# printing type

print("type(tuple1): ", type(tuple1))

Output

輸出量

tuple1: ()

len(tuple1): 0

type(tuple1):

Example 2:

范例2:

We can also create an empty tuple by initializing the tuple with tuple() – generally this method is used to clear/reinitialize the tuple.

也可以通過使用tuple()初始化元組來創(chuàng)建一個(gè)空元 組 -通常,此方法用于清除/重新初始化元組。

# Python empty tuple creation`

tuple1 = tuple()

# printing tuple

print("tuple1: ", tuple1)

# printing