In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly shows you "what are the methods of variable merging in python", the content is simple and clear, and I hope it can help you solve your doubts. Let me lead you to study and learn about "what are the methods of variable merging in python".
I. list merger
The first method:
A = [91 c.sort 95 c.sort (reverse=True) # sort reverse order print (c))
The second method:
A = [91 a.sort 95 print 99] b = [92 recollection 93 Reagin 96 Magazine 98] a [0:0] = b # merge Jet ()
The third method:
A = [91 print 95, 97 print 99] b = [92, 93, 96, and 98] a + = b # merge ()
The fourth method:
A = [91 print 95 print 97 print 99] b = [92 recollection 93 repartee 96 Magazine 98] GetWord (b) # amalgamated a.sort ()
The fifth method: here is to put the entire list b into a, not recommended
A = [91pr 95pr 97je 99] b = [92pr 93pr 96m 98] a.append (b) # merge print (a) II, str merge
The first kind:
A = 'your name is:' B = 'Xiao Ming' print (axib)
The second kind:
A = 'your name:' b = 'Xiao Ming' print ("% s% s"% (a, b)) 3. Dict merger
The first kind:
Y = {'averse: 10,' baked: 8} t = {'daddy: 6,' croup: 4} # merge t into y and y.update (t) print (y)
The second kind:
Y = {'axie: 10,' baked: 8} t = {'daddy: 6,' cession: 4} print ({* * y, * * t}) # dictionary split, keyword
The third kind:
Y = {'aquired: 10,' baked: 8} t = {'dashed: 6,' cached: 4} f = dict (y) # dictionary constructor f.update (t) # Update print (f)
The fourth kind:
Y = {'averse: 10,' baked: 8} t = {'daddy: 6,' centering: 4} c = dict (list (y.items ()) + list (t.items () print (c) the above are all the contents of the article "what are the methods of variable merging in python". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.