I want to convert a tuple as
t = [(4,10),(9,7),(11,2),(2,2)]
into a 2D array, for example:
a = [[4,10],[9,7],[11,2],[2,2]]
I tried
a = [] for i in t: a.append(np.asarray(i)) print a
is there an easier way?
Use listas follows:
list
>>> t = [(4,10),(9,7),(11,2),(2,2)] >>> [list(item) for item in t] [[4, 10], [9, 7], [11, 2], [2, 2]]
Source: https://habr.com/ru/post/1624674/More articles:How to prevent mutation of an object / array - javascriptHow to replace pthread_create during connection - chttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1624671/bad-symbolic-reference-a-signature-in-webuiclass-refers-to-term-eclipse-in-package-org-which-is-not-available&usg=ALkJrhhpqPH9w-6xmdlFCjTdEs9heNhMbwAngular: what is the difference between declaring a service in a component and the boot process - javascriptCannot find another supporting object, Async pipe and ngFor problems in angular2 - angularKeep working with the perl script - perlLive from GoPro 4 to Android - androidChanging the color of a specific tick in ggplot2 - rhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1624678/how-to-assign-html-form-multiple-selected-options-to-php-variable&usg=ALkJrhgs5FvFmJDfTX4vOzBY7mjWh7DUkQHow to restructure this bit of code? - c #All Articles