[Tutor] Q about .join() Thanks!

Joaquin Alzola Joaquin.Alzola at lebara.com
Mon Feb 13 20:25:35 EST 2017


>I find out that the outcome for using .join() on a dictionary is totally different than it using on list or string. for example,

 >                 >>> seq4 = {'hello':1,'good':2,'boy':3,'doiido':4}
 >                 >>>
 >                 boy:good:doiido:hello
>So my question is why the outcome doesn't show sequentially as the same sequence of the original seq4?  What pattern do those "keys" of the dictionary in the outcome show ?

Dictionaries are not an ordered sequence.

In order to do that you need to create and OrderedDict (in collections)

Modern Dictionaries --> https://www.youtube.com/watch?v=p33CVV29OG8
The mighty Dictionary --> https://www.youtube.com/watch?v=C4Kc8xzcA68&t=142s
This email is confidential and may be subject to privilege. If you are not the intended recipient, please do not copy or disclose its content but contact the sender immediately upon receipt.


More information about the Tutor mailing list