Python Forum
how does .join work with list and dictionaries
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
how does .join work with list and dictionaries
#2
.join() makes a concatenated string of an iterable, in your case of a dictionary at place [loc] in a list of dictionaries.
The elements are separated by a ','.join , comma in your example.
This is done to present the list of choices in a nicer format.
exits[loc][direction] : says that you need to take the dictionary number [loc] and specifically the value with key [direction]
Paul
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Reply


Messages In This Thread
RE: how does .join work with list and dictionaries - by DPaul - Jun-26-2020, 07:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extending list doesn't work as expected mmhmjanssen 2 238 May-09-2024, 05:39 PM
Last Post: Pedroski55
  Sort a list of dictionaries by the only dictionary key Calab 2 687 Apr-29-2024, 04:38 PM
Last Post: Calab
  Access list of dictionaries britesc 4 1,161 Jul-26-2023, 05:00 AM
Last Post: Pedroski55
  Why do I have to repeat items in list slices in order to make this work? Pythonica 7 1,442 May-22-2023, 10:39 PM
Last Post: ICanIBB
  Beginner: Code not work when longer list raiviscoding 2 887 May-19-2023, 11:19 AM
Last Post: deanhystad
  How to work with list kafka_trial 8 2,113 Jan-24-2023, 01:30 PM
Last Post: jefsummers
  Join dataframes... So simple but I can't work it out! snakes 1 1,405 Oct-27-2021, 09:15 AM
Last Post: snakes
  function that returns a list of dictionaries nostradamus64 2 1,825 May-06-2021, 09:58 PM
Last Post: nostradamus64
  convert List with dictionaries to a single dictionary iamaghost 3 2,914 Jan-22-2021, 03:56 PM
Last Post: iamaghost
  The difference between os.path.join( and os.sep.join( Pedroski55 2 9,626 Nov-17-2020, 08:38 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

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