per page, with , order by , clip by
Results of 1 - 4 of about 4 for pear (0.002 sec.)
5. データ構造 12316
5. データ構造 この章では、すでに学んだことについてより詳しく説明するとともに、いくつか新しいことを追加します。 5.1. リスト型についてもう少し list 型には、他にもいくつかメソッドがあります。リストオブジェクトのすべてのメソッドを以下に示します ... ピーを返します。 a[:] と同様です。 以下にリストのメソッドをほぼ全て使った例を示します: >>> fruits = [ 'orange' , 'apple' , 'pear' , 'banana' , 'kiwi' , 'apple' , 'banana' ] >>> fruits . count ( 'apple' ) 2 >>> fruits . count ( 'tangerine' ) 0 >>> frui ... ) # インデックス4から数えて次の banana の位置 6 >>> fruits . reverse () >>> fruits ['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'orange'] >>> fruits . append ( 'grape' ) >>> fruits ['banana', 'apple', 'kiwi', 'banana', 'pear', 'apple', 'or ... ange', 'grape'] >>> fruits . sort () >>> fruits ['apple', 'apple', 'banana', 'banana', 'grape', 'kiwi', 'orange', 'pear'] >>> fruits . pop () 'pear' insert 、 remove 、 sort など、リストの変更だけを行うメソッドの戻り値が表示されていないことに ...
https://man.mtool.work/python/3.14/tutorial/datastructures.html
What's New In Python 3.1 8931
What's New In Python 3.1 著者 : Raymond Hettinger この記事では Python 3.0 と比較した Python 3.1 の新機能を説明します。 Python 3.1 は 2009 年 6 月 27 日にリリースされました。 PEP 372: 順序付き辞書 通常の Python 辞書は、 key/value ペアを不定の ... み合わせて使うことで、ソートされた辞書を作れます: >>> # 通常のソートされていない辞書 >>> d = { 'banana' : 3 , 'apple' : 4 , 'pear' : 1 , 'orange' : 2 } >>> # キーでソートした辞書 >>> OrderedDict ( sorted ( d . items (), key = lambda t : t [ 0 ])) Order ... edDict([('apple', 4), ('banana', 3), ('orange', 2), ('pear', 1)]) >>> # 値でソートした辞書 >>> OrderedDict ( sorted ( d . items (), key = lambda t : t [ 1 ])) OrderedDict([('pear', ... キー文字列の長さでソートした辞書 >>> OrderedDict ( sorted ( d . items (), key = lambda t : len ( t [ 0 ]))) OrderedDict([('pear', 1), ('apple', 4), ('orange', 2), ('banana', 3)]) この新しい順序付き辞書は、項目が削除されてもソートされた順序を保持します ...
https://man.mtool.work/python/3.14/whatsnew/3.1.html
operator --- 関数形式の標準演算子 8136
operator --- 関数形式の標準演算子 ソースコード: Lib/operator.py operator モジュールは、Python の組み込み演算子に対応する効率的な関数を提供します。 例えば、 operator.add(x, y) は式 x+y と同等です。 多くの関数名は、特殊メソッドの名前から二重ア ... temgetter() を使って特定のフィールドをタプルレコードから取り出す例: >>> inventory = [( 'apple' , 3 ), ( 'banana' , 2 ), ( 'pear' , 5 ), ( 'orange' , 1 )] >>> getcount = itemgetter ( 1 ) >>> list ( map ( getcount , inventory )) [3, 2, 5, 1] >>> sorted ... ( inventory , key = getcount ) [('orange', 1), ('banana', 2), ('apple', 3), ('pear', 5)] operator. methodcaller ( name , / , * args , ** kwargs ) 引数の name メソッドを呼び出す呼び出し可能オブジェクトを返し ...
https://man.mtool.work/python/3.14/library/operator.html
10. 標準ライブラリをひとめぐり 7544
10. 標準ライブラリをひとめぐり 10.1. オペレーティングシステムとのインターフェース os モジュールは、オペレーティングシステムと対話するための多くの関数を提供しています: >>> import os >>> os . getcwd () # Return the current working directory ' ... om モジュールは、乱数に基づいた要素選択のためのツールを提供しています: >>> import random >>> random . choice ([ 'apple' , 'pear' , 'banana' ]) 'apple' >>> random . sample ( range ( 100 ), 10 ) # 重複なしでサンプリング [30, 83, 16, 4, 8, 81, 41, 50, 1 ...
https://man.mtool.work/python/3.14/tutorial/stdlib.html
PREV 1 NEXT