日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

python 初始化 元组_在Python中重新初始化元组

發(fā)布時間:2023/12/1 python 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python 初始化 元组_在Python中重新初始化元组 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

python 初始化 元組

Python | 重新初始化元組 (Python | Reinitializing tuple)

In this tutorial, we will learn how can we reinitialize a tuple with a new set of elements/objects?

在本教程中,我們將學習如何使用一組新的元素/對象重新初始化元組?

To reinitialize a tuple, we can use tuple() or a pair of round brackets (), the steps are,

重新初始化元組 ,我們可以使用tuple()或一對圓括號() ,步驟是,

  • Reinitialize the tuple using () or tuple()

    使用()或tuple()重新初始化元組

  • Reassign the new set of objects/elements

    重新分配新的對象/元素集

  • Consider the below program,

    考慮下面的程序,

    # Reinitializing a tuple in Python# tuple creation x = ("Shivang", 21, "Indore", 9999867123)# printing original tuple print("x: ", x) print("len(x): ", len(x)) print("type(x): ", type(x)) print()# Reinitializing tuple using tuple() x = tuple() # assigning new objects x = (10, 20, 30, 40, 50) print("x: ", x) print("len(x): ", len(x)) print("type(x): ", type(x)) print()# Reinitializing tuple using () x = () # assigning new objects x = ("Amit", 18, "Jaipur", 98.24, 8888888888) print("x: ", x) print("len(x): ", len(x)) print("type(x): ", type(x)) print()

    Output

    輸出量

    x: ('Shivang', 21, 'Indore', 9999867123) len(x): 4 type(x): <class 'tuple'>x: (10, 20, 30, 40, 50) len(x): 5 type(x): <class 'tuple'>x: ('Amit', 18, 'Jaipur', 98.24, 8888888888) len(x): 5 type(x): <class 'tuple'>

    翻譯自: https://www.includehelp.com/python/reinitializing-a-tuple.aspx

    python 初始化 元組

    總結

    以上是生活随笔為你收集整理的python 初始化 元组_在Python中重新初始化元组的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

    如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。