In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article shows you how to use python's advanced built-in functions, which are concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
1. Enumerate returns enumerated objects for iterable objects of sequence types.
2. Eval takes out the contents of the string.
Returns the evaluation result of a valid expression in str.
3. Exec runs the compiled string.
4. Filter filter filters out the desired objects.
An enumerated object for i in s: print (I) # (0,1) # (1djinokok') # (2,3) # (3mementkkkkk') data = list (s) print (data) # [(0,1), (1pencyclok'), (2,3), (3) [(0,1), (list1) print (s) #] is generated. 'kkk')] a =' 1+2+3'print (a) # 1+2+3print (eval (a)) # 6b ='we's slots # print (eval (b)) # error report Must be a valid expression c = 12d = 24e = 'sum = c+d'print (e) # sum = c+dexec (e) print (sum) # 36 def func (x): return x > 5List2 = [i for i in range (10)] print (func (6)) # Truef_list = filter (func,list2) print (f_list) # returns a filter object list3 = list (f_list) print (list3) # [6,7,8 9] def func1 (y): if y > 5: return yellow2list4 = [i for i in range (10)] f_list = filter (func1,list4) list5 = list (f_list) print (list5) # [6, 7, 8, 9] # filter only What is filtered is what is returned, and the value def func2 (k): if k is not changed.
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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.