Results of 1 - 10 of about 102 for sorted (0.006 sec.)
- ソートのテクニック — Python 3.14.8 ドキュメント 15140
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » ソートのテクニック テーマ 自動 ライト ダーク | ソートのテクニック ¶ Author : Andrew Dalke and Raymond Hettinger Python のリストにはリストをインプレ
...ースに変更する、組み込みメソッド list.sort() があります。他にもイテラブルからソートしたリストを作成する組み込み関数 sorted() があります。 このドキュメントでは Python を使った様々なソートのテクニックを探索します。 ソートの基本 ¶ 単純な昇順のソート...はとても簡単です: sorted() 関数を呼ぶだけです。そうすれば、新たにソートされたリストが返されます: >>> sorted ([ 5 , 2 , 3 , 1 , 4 ]) [1, 2, 3, 4, 5]...list.sort() メソッドを呼びだしても同じことができます。この方法はリストをインプレースに変更します (そして sorted との混乱を避けるため None を返します)。多くの場合、こちらの方法は sorted() と比べると不便です - ただし、元々のリストが不要... - https://man.mtool.work/python/3.14/howto/sorting.html
- ソートのテクニック — Python 3.14.8 ドキュメント 15140
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » Python HOWTO » ソートのテクニック テーマ 自動 ライト ダーク | ソートのテクニック ¶ Author : Andrew Dalke and Raymond Hettinger Python のリストにはリストをインプレ
...ースに変更する、組み込みメソッド list.sort() があります。他にもイテラブルからソートしたリストを作成する組み込み関数 sorted() があります。 このドキュメントでは Python を使った様々なソートのテクニックを探索します。 ソートの基本 ¶ 単純な昇順のソート...はとても簡単です: sorted() 関数を呼ぶだけです。そうすれば、新たにソートされたリストが返されます: >>> sorted ([ 5 , 2 , 3 , 1 , 4 ]) [1, 2, 3, 4, 5]...list.sort() メソッドを呼びだしても同じことができます。この方法はリストをインプレースに変更します (そして sorted との混乱を避けるため None を返します)。多くの場合、こちらの方法は sorted() と比べると不便です - ただし、元々のリストが不要... - https://man.mtool.work/python/3.14/howto/sorting.html
- heapq --- ヒープキューアルゴリズム — Python 3.14.8 ドキュメント 7699
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » データ型 » heapq --- ヒープキューアルゴリズム テーマ 自動 ライト ダーク | heapq --- ヒープキューアルゴリズム ¶ ソースコード: Lib/he
...にします (たとえば、複数のログファイルの時刻の入ったエントリーをマージします)。ソートされた値にわたる iterator を返します。 sorted(itertools.chain(*iterables)) と似ていますが、イテレータを返し、一度にはデータをメモリに読み込まず、それぞれの入力ストリーム...(要素を直接比較します)。 reverse は真偽値です。 True を設定した場合、挿入要素は逆向きに比較されたかのように結合されます。 sorted(itertools.chain(*iterables), reverse=True) でこれに似た挙動を実現するには、全てのイテラブルは降順で並んでいなければなりませ...引数を一つとる、 iterable のそれぞれの要素から比較キーを生成する関数を指定します(例 key=str.lower )。以下のコードと同等です: sorted(iterable, key=key, reverse=True)[:n] heapq. nsmallest ( n , iterable , key = None ) ¶ iterable で定義されるデータセットのう... - https://man.mtool.work/python/3.14/library/heapq.html
- heapq --- ヒープキューアルゴリズム — Python 3.14.8 ドキュメント 7479
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » データ型 » heapq --- ヒープキューアルゴリズム テーマ 自動 ライト ダーク | heapq --- ヒープキューアルゴリズム ¶ ソースコード: Lib/he
...にします (たとえば、複数のログファイルの時刻の入ったエントリーをマージします)。ソートされた値にわたる iterator を返します。 sorted(itertools.chain(*iterables)) と似ていますが、イテレータを返し、一度にはデータをメモリに読み込まず、それぞれの入力ストリーム...(要素を直接比較します)。 reverse は真偽値です。 True を設定した場合、挿入要素は逆向きに比較されたかのように結合されます。 sorted(itertools.chain(*iterables), reverse=True) でこれに似た挙動を実現するには、全てのイテラブルは降順で並んでいなければなりませ...引数を一つとる、 iterable のそれぞれの要素から比較キーを生成する関数を指定します(例 key=str.lower )。以下のコードと同等です: sorted(iterable, key=key, reverse=True)[:n] heapq. nsmallest ( n , iterable , key = None ) ¶ iterable で定義されるデータセットのう... - https://man.mtool.work/python/3.14/library/heapq.html
- itertools --- 効率的なループ用のイテレータ生成関数群 — Python 3.14.8 ドキュメン... 7479
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » itertools --- 効率的なループ用のイテレータ生成関数群 テーマ 自動 ライト ダーク | itertools --- 効
...bination tuples are emitted in lexicographic order according to the order of the input iterable . If the input iterable is sorted, the output tuples will be produced in sorted order. Elements are treated as unique based on their position, not on their...bination tuples are emitted in lexicographic order according to the order of the input iterable . if the input iterable is sorted, the output tuples will be produced in sorted order. Elements are treated as unique based on their position, not on their...ってしまいます。従って、データが後で必要な場合にはリストの形で保存しておく必要があります: groups = [] uniquekeys = [] data = sorted ( data , key = keyfunc ) for k , g in groupby ( data , keyfunc ): groups . append ( list ( g )) # Store group iterator as... - https://man.mtool.work/python/3.14/library/itertools.html
- itertools --- 効率的なループ用のイテレータ生成関数群 — Python 3.14.8 ドキュメン... 7479
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » The Python standard library » 関数型プログラミング用モジュール » itertools --- 効率的なループ用のイテレータ生成関数群 テーマ 自動 ライト ダーク | itertools --- 効
...bination tuples are emitted in lexicographic order according to the order of the input iterable . If the input iterable is sorted, the output tuples will be produced in sorted order. Elements are treated as unique based on their position, not on their...bination tuples are emitted in lexicographic order according to the order of the input iterable . if the input iterable is sorted, the output tuples will be produced in sorted order. Elements are treated as unique based on their position, not on their...ってしまいます。従って、データが後で必要な場合にはリストの形で保存しておく必要があります: groups = [] uniquekeys = [] data = sorted ( data , key = keyfunc ) for k , g in groupby ( data , keyfunc ): groups . append ( list ( g )) # Store group iterator as... - https://man.mtool.work/python/3.14/library/itertools.html
- What's New In Python 3.1 — Python 3.14.8 ドキュメント 7415
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New In Python 3.1 テーマ 自動 ライト ダーク | What's New In Python 3.1 ¶ 著者 : Raymond Hettinger This article explains the new fea
...ttinger. 順序付き辞書は挿入順序を記憶するので、ソートと組み合わせて使うことで、ソートされた辞書を作れます: >>> # regular unsorted dictionary >>> d = { 'banana' : 3 , 'apple' : 4 , 'pear' : 1 , 'orange' : 2 } >>> # dictionary sorted by key >>> OrderedDi...ct ( sorted ( d . items (), key = lambda t : t [ 0 ])) OrderedDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)]) >>> # di...ctionary sorted by value >>> OrderedDict ( sorted ( d . items (), key = lambda t : t [ 1 ])) OrderedDict([('pear', 1), ('orange', 2), ('ba... - https://man.mtool.work/python/3.14/whatsnew/3.1.html
- What's New In Python 3.1 — Python 3.14.8 ドキュメント 7415
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New In Python 3.1 テーマ 自動 ライト ダーク | What's New In Python 3.1 ¶ 著者 : Raymond Hettinger This article explains the new fea
...ttinger. 順序付き辞書は挿入順序を記憶するので、ソートと組み合わせて使うことで、ソートされた辞書を作れます: >>> # regular unsorted dictionary >>> d = { 'banana' : 3 , 'apple' : 4 , 'pear' : 1 , 'orange' : 2 } >>> # dictionary sorted by key >>> OrderedDi...ct ( sorted ( d . items (), key = lambda t : t [ 0 ])) OrderedDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)]) >>> # di...ctionary sorted by value >>> OrderedDict ( sorted ( d . items (), key = lambda t : t [ 1 ])) OrderedDict([('pear', 1), ('orange', 2), ('ba... - https://man.mtool.work/python/3.14/whatsnew/3.1.html
- What's New in Python 2.4 — Python 3.14.8 ドキュメント 7272
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New in Python 2.4 テーマ 自動 ライト ダーク | What's New in Python 2.4 ¶ 著者 : A.M. Kuchling この文書は 2005 年 3 月 30 日にリリー
...いますが同年齢の人物は名前順です。 (All changes to sort() contributed by Raymond Hettinger.) 新たに追加されたビルトイン関数 sorted(iterable) はインプレイスなメソッド list.sort() と似た振る舞いをしますが、式内で使えます。違いは: 入力には任意のイテラブルを...ます; そして 式として新しいソート済みコピーを返します。 >>> L = [ 9 , 7 , 8 , 3 , 2 , 4 , 1 , 6 , 5 ] >>> [ 10 + i for i in sorted ( L )] # usable in a list comprehension [11, 12, 13, 14, 15, 16, 17, 18, 19] >>> L # original is left unchanged [9,7,8,3,2...,4,1,6,5] >>> sorted ( 'Monty Python' ) # any iterable may be an input [' ', 'M', 'P', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y', 'y'] >>> # List... - https://man.mtool.work/python/3.14/whatsnew/2.4.html
- What's New in Python 2.4 — Python 3.14.8 ドキュメント 7272
- ナビゲーション 索引 モジュール | 次へ | 前へ | Python » 3.14.8 Documentation » What's New in Python » What's New in Python 2.4 テーマ 自動 ライト ダーク | What's New in Python 2.4 ¶ 著者 : A.M. Kuchling この文書は 2005 年 3 月 30 日にリリー
...いますが同年齢の人物は名前順です。 (All changes to sort() contributed by Raymond Hettinger.) 新たに追加されたビルトイン関数 sorted(iterable) はインプレイスなメソッド list.sort() と似た振る舞いをしますが、式内で使えます。違いは: 入力には任意のイテラブルを...ます; そして 式として新しいソート済みコピーを返します。 >>> L = [ 9 , 7 , 8 , 3 , 2 , 4 , 1 , 6 , 5 ] >>> [ 10 + i for i in sorted ( L )] # usable in a list comprehension [11, 12, 13, 14, 15, 16, 17, 18, 19] >>> L # original is left unchanged [9,7,8,3,2...,4,1,6,5] >>> sorted ( 'Monty Python' ) # any iterable may be an input [' ', 'M', 'P', 'h', 'n', 'n', 'o', 'o', 't', 't', 'y', 'y'] >>> # List... - https://man.mtool.work/python/3.14/whatsnew/2.4.html