Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Saving list in a list
#1
Hello I am trying to save my list into another list. I actually do it but it is saved like

array([0, 0]), array([0, 1])
However I want to save like that:

[0,1],[0,0]...
my code is here:

results_ = []
measurements = results.samples[0] # I could manage to get my list like [0,0] [1,1]
print("measurements",measurements) # I am printing my measurements and it is ok they are coming like [0,0][1,1]
results_.append(measurements) # I am adding to another list and here is the problem.they are coming : array([0, 0]),array([0, 1])
print("results",results_)    
sebep = sorted(results_)    
print(results_)
here is my output:
Output:
measurements [1 1] measurements [0 1] measurements [0 0] measurements [0 1] measurements [0 0] measurements [1 1] measurements [0 1] measurements [0 1] results [array([1, 1]), array([0, 1]), array([0, 0]), array([0, 1]), array([0, 0]), array([1, 1]), array([0, 1])
Reply


Messages In This Thread
Saving list in a list - by quest_ - Mar-08-2021, 01:44 PM
RE: Saving list in a list - by Larz60+ - Mar-08-2021, 02:09 PM
RE: Saving list in a list - by snippsat - Mar-08-2021, 02:41 PM
RE: Saving list in a list - by quest_ - Mar-10-2021, 09:58 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  No matter what I do I get back "List indices must be integers or slices, not list" Radical 4 1,172 Sep-24-2023, 05:03 AM
Last Post: deanhystad
  Delete strings from a list to create a new only number list Dvdscot 8 1,540 May-01-2023, 09:06 PM
Last Post: deanhystad
  List all possibilities of a nested-list by flattened lists sparkt 1 919 Feb-23-2023, 02:21 PM
Last Post: sparkt
  Сheck if an element from a list is in another list that contains a namedtuple elnk 8 1,839 Oct-26-2022, 04:03 PM
Last Post: deanhystad
Question Keyword to build list from list of objects? pfdjhfuys 3 1,568 Aug-06-2022, 11:39 PM
Last Post: Pedroski55
  Split a number to list and list sum must be number sunny9495 5 2,289 Apr-28-2022, 09:32 AM
Last Post: Dexty
  How to check if a list is in another list finndude 4 1,837 Jan-17-2022, 05:04 PM
Last Post: bowlofred
  Different out when using conda list and pip list Led_Zeppelin 1 4,043 Jan-14-2022, 09:30 PM
Last Post: snippsat
  Use one list as search key for another list with sublist of list jc4d 4 2,163 Jan-11-2022, 12:10 PM
Last Post: jc4d
  Need to parse a list of boolean columns inside a list and return true values Python84 4 2,110 Jan-09-2022, 02:39 AM
Last Post: Python84

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020