In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to achieve the general operation of the list in Python, many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Code implementation
# list stitching my_list = [1Power2Power3] + [4Power5Power6] print ('the list after stitching is:', my_list) # repeating list my_list = [7pc8, my_list] * 3print ('list after repeating 3 times is:', my_list) # create list stus = ['Sun WuKong', 'Zhu Bajie', 'Sha Wujing', 'Tang monk', 'spider essence', 'Baigujing', 'Sha Wujing' 'Sha Wujing'] # find whether the element is in the list print ('determine whether the spider sperm is true in stus:', 'spider spirit' in stus) print ('judge whether the Bull Devil King is not true in stus:', 'Bull Devil King' not in stus) print ('statistics on the number of uranium Sha Wujing in stus:', stus.count ('Sha Wujing')) print ('stus length is:' Len (stus)) # find the minimum and maximum values in the list my_arr= [10, max 3, 2, 4, 222] print ('minimum in my_arr:', min (my_arr)) print ('maximum in my_arr:', max (my_arr)
Code run output:
The stitched list is [1, 2, 3, 4, 5, 6]
Repeat 3 and the following list is: [7, 8, 9, 7, 8, 9, 7, 8, 9]
Determine whether the spider essence is true in stus: True
Determine whether the Bull Devil King is not in stus is true: True
Statistics of several uranium in stus Sha Wujing: 3
The length of stus is: 8
The minimum value in my_arr is: 2
The maximum value in my_arr is: 222
After reading the above, do you have any further understanding of how to implement list common operations in Python? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.