Python Forum
function for extracting data from lists
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function for extracting data from lists
#9
Nono, this is what you do:
y = []       # create empty list with name "y"
...
y=x[key]     # y = 19.75; Now y is a floating point number
y.append(x)  # append something to a float???
append() is a method of list. So you must do:
y = []
...
y.append(x[key])
... and after the for-loop has finished you will have a list with all the data that you want.
Paulman likes this post
Reply


Messages In This Thread
RE: function for extracting data from lists - by ibreeden - Nov-09-2021, 03:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Recursive Function - Compare 2 lists, return the elements that don't exist in both KellyBaptist 1 6,321 Dec-23-2018, 10:10 AM
Last Post: Gribouillis
  Questions on lists, the range function & concatenation fad3r 7 5,725 Jan-25-2018, 03:11 PM
Last Post: fad3r
  How to extract two data types from a text file and store them as two separate lists banf 1 4,068 Jan-16-2017, 09:52 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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