Reasons for demand:
Recently I have been using Python to do some small demos, especially I often use Python to do some data processing operations, so the question arises: how to make the data processing better and can directly use the case? In other words, what are python “tricks” that can help me process data quickly? Therefore, I collected some cases, combined with my actual work needs, and made these cases into a continuous update. Today, I will talk about one, that is, how to make the numbers in two list instances add one by one.
Requirement objectives:
How to add the numbers in two lists of the same length
In the case of two list instances, how to make the numbers in the list add one by one.
A_list = [1.2.3.4.5.6B_list = [9.8.7.6.5.4# import numpy libraryimport numpy asB_arr = Np.array (a_list) b_arr = Np.array (b_list) Add_list = list(add_arr) print(add_list) print(add_list)Copy the code
Conclusion: This is a continuing article that will be updated as new Python utility cases become available