I think it is strange that a set looses order

A forum for general discussion of the Python programming language.

I think it is strange that a set looses order

Postby mnjkagadeesh » Wed Apr 24, 2013 2:24 pm


I am trying to eleminate duplicate characters from the string. So I used set like this

>>>print "".join(set("abcabc"))

It prints acb instead of abc.

may I know why

Last edited by Yoriz on Wed Apr 24, 2013 3:53 pm, edited 1 time in total.
Reason: changed to a more descriptive title
Posts: 1
Joined: Wed Apr 24, 2013 2:19 pm

Re: I think it is strange

Postby Yoriz » Wed Apr 24, 2013 3:50 pm

A set object is an unordered collection of distinct hashable objects.
Due to the reasons discussed here we will be moving to python-forum.io/ on October 1 2016
This forum will be locked down and no one will be able to post/edit/create threads, etc. here from thereafter. Please create an account at the new site to continue discussion.
User avatar
Posts: 1671
Joined: Fri Feb 08, 2013 1:35 am
Location: UK

Return to General Discussions

Who is online

Users browsing this forum: No registered users and 1 guest