In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
The editor will share with you how the tuple in Python is expressed. I hope you will get something after reading this article. Let's discuss it together.
The tuple uses parentheses to indicate that once the tuple is initialized, it cannot be modified, and when defining the tuple, the elements of the tuple must be determined.
ATuple = (1, 2, 3) # tuple data cannot be modified aTuple [2] = "TypeError: 'tuple' object does not support item assignment
() stands for tuple, but can also be defined as mathematical symbol parentheses. To avoid ambiguity, the tuple of only one element must have a comma (,) at the end of the element.
Tu = (1) print (type (tu)) tu = (1,) print (type (tu)) # # tuple and array tu = (1) print (list (tu)) # tuple to array li = [1 to print (tuple (li)) # array to tuple # [1 to 2 to 4) string and tuple print ("my name is% s, I am d% this year" I have now finished reading this article at% s "% (" bx ", 25," beijing "). I believe you have a certain understanding of "how tuples are represented in Python". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.