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

Hi,

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

Thanks
Last edited by Yoriz on Wed Apr 24, 2013 3:53 pm, edited 1 time in total.
Reason: changed to a more descriptive title
mnjkagadeesh
 
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.
New Users, Read This
Join the #python-forum IRC channel on irc.freenode.net!
Spam topic disapproval technician
Windows7, Python 2.7.4., WxPython 2.9.5.0., some Python 3.3
User avatar
Yoriz
 
Posts: 782
Joined: Fri Feb 08, 2013 1:35 am
Location: UK


Return to General Discussions

Who is online

Users browsing this forum: Google [Bot] and 3 guests