Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Iteration of an array
#1
I have an two-dimm array, with the "internal" array as a named tuple.

EG: I have
obj_list= []
my_Object = namedtuple('my_Object', 'name attribute1 attribute2')
then throughout my program
obj_list.append(my_Object (name,attribute1 ,attribute1 ) )
however, when I try to unpack, I'm getting "lost" in how to do so

when I print
	print (obj_list[2]))
	print (obj_list[6]))
I get :::
Output:
['list-name-a', ['ojbect2', 'object5']] ['list-name-f', ['ojbect1', 'object2' 'object4' 'object7']]
-- howeverI can't figure out how to extract "object2" and "object5" as strings...especially wehn there's potential multiple objects

storing the multi-dim array made total sense, unpacking (extracting) it -- has me scratching my head

thanks in advance,
Pappa Bear
p.s. not even sure what to google for this one.
Reply


Messages In This Thread
Iteration of an array - by PappaBear - May-22-2019, 11:11 PM
RE: Iteration of an array - by micseydel - May-23-2019, 12:13 AM
RE: Iteration of an array - by perfringo - May-23-2019, 05:34 AM
RE: Iteration of an array - by PappaBear - May-23-2019, 05:48 PM
RE: Iteration of an array - by Yoriz - May-23-2019, 06:14 PM
RE: Iteration of an array - by PappaBear - May-23-2019, 06:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Array Iteration/Merging Milo 4 2,876 Jun-13-2018, 02:42 PM
Last Post: Milo

Forum Jump:

User Panel Messages

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