🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.python
Article #8393

Re: sortowanie slownika (dict)

#8393
From: Adam Przybyla
Date: Tue, 26 Apr 2005 11:49
47 lines
2108 bytes
[ PorkOne ] <porkone@wp.pl> wrote:
> William wrote:
>> Użytkownik "[ PorkOne ]" <porkone@wp.pl> napisał w wiadomości
>> news:d4l7iu$ip6$1@nemesis.news.tpi.pl...
>> 
>>>Witam.
>>>W jaki sposob wylaczyc automatyczne sortowanie slownika? Czy wogole jest
>>>taka mozliwosc?
>> 
>> 
>> Jak ci się słownik sortuje ?
>> 
>> 
> Robie slownik:
> 
> d = {}
> d["aaa"] = "xxxx"
> d["bbb"] = "yyyy"
> d["ccc"] = "zzzz"
> 
> i jak dam:
> 
> print d.keys()
> 
> to dostane klucze, ale nie w takiej kolejnosci jak wstawilem, czyli nie:
> 
> aaa, bbb, ccc
> 
> tylko na przyklad:
> 
> bbb, ccc, aaa
gormenghast:/home/adam>python
Python 2.2.3 (#1, Oct 15 2003, 23:33:35)
[GCC 3.3.1 20030930 (Red Hat Linux 3.3.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> x={1:3,7:4,2:777}
>>> x
{1: 3, 2: 777, 7: 4}
>>> x[777]=4
>>> x[0]=4
>>> x
{0: 4, 1: 3, 2: 777, 777: 4, 7: 4}
>>> x.keys()
[0, 1, 2, 777, 7]
>>>
cos się nie sortuja maja zupelnei inna strukture;-) Nie musisz się obawiac:) Z powazaniem
								Adam Przybyla
Technical Details
Message-ID: <d4l9rh$6cl$1@nemesis.news.tpi.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!newsfeed.silweb.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!news.tpi.pl!not-for-mail
References: <d4l7iu$ip6$1@nemesis.news.tpi.pl> <d4l8pt$ha2$1@inews.gazeta.pl> <d4l9fq$570$1@nemesis.news.tpi.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!mat.uni.torun.pl!news.man.torun.pl!newsfeed.pionier.net.pl!newsfeed.silweb.pl!newsfeed.tpinternet.pl!nemesis.news.tpi.pl!news.tpi.pl!not-for-mail
From: Adam Przybyla <adam@gliwice.pl>
Newsgroups: pl.comp.lang.python
Subject: Re: sortowanie slownika (dict)
Date: Tue, 26 Apr 2005 11:49:05 +0000 (UTC)
Organization: tp.internet - http://www.tpi.pl/
Lines: 47
Sender: Adam Przybyla <adam@gormenghast.ertel.com.pl>
Message-ID: <d4l9rh$6cl$1@nemesis.news.tpi.pl>
References: <d4l7iu$ip6$1@nemesis.news.tpi.pl> <d4l8pt$ha2$1@inews.gazeta.pl> <d4l9fq$570$1@nemesis.news.tpi.pl>
NNTP-Posting-Host: gormenghast.ertel.com.pl
Mime-Version: 1.0
X-Trace: nemesis.news.tpi.pl 1114516145 6549 195.116.54.244 (26 Apr 2005 11:49:05 GMT)
X-Complaints-To: usenet@tpi.pl
NNTP-Posting-Date: Tue, 26 Apr 2005 11:49:05 +0000 (UTC)
User-Agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (Linux/2.4.22-1.2199.nptl (i686))
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit