per page, with , order by , clip by
Results of 1 - 10 of about 58 for point (0.009 sec.)
4. その他の制御フローツール 12924
4. その他の制御フローツール 前章で紹介した while 文の他にも、 Python にはいくつか制御フローツールがあり、本章で説明します。 4.1. if 文 おそらく最もおなじみの文型は if 文でしょう。例えば: >>> x = int ( input ( "Please enter an integer: " )) ... 403 | 404 : return "Not allowed" パターンはアンパック代入に似た形で書くことができ、変数に値を結びつけるために使えます。 # point は (x, y) のタプル match point : case ( 0 , 0 ): print ( "Origin" ) case ( 0 , y ): print ( f "Y= { y } " ) case ( x , 0 ) ... : print ( f "X= { x } " ) case ( x , y ): print ( f "X= { x } , Y= { y } " ) case _ : raise ValueError ( "Not a point" ) このコードは注意して見てください! 最初のパターンには2つのリテラルがあり、上で示したリテラルパターンの拡張と考えることが ... できます。 しかし次の2つのパターンはリテラルと変数の組み合わせのため、対象( point )から値を取り出して変数に 結びつけ ます。 4番目のパターンは2つの値を取り込みます。 これは、アンパック代入 (x, y) = point と ...
https://man.mtool.work/python/3.14/tutorial/controlflow.html
xml.dom.minidom --- 最小限の DOM の実装 12207
xml.dom.minidom --- 最小限の DOM の実装 ソースコード: Lib/xml/dom/minidom.py xml.dom.minidom は Document Object Model インターフェースの最小限の実装で、他の言語の実装と同様の API を備えています。 完全な DOM より単純で、大幅に小さい実装を目指 ... せん。 import xml.dom.minidom document = """ \ <slideshow> <title>Demo slideshow</title> <slide><title>Slide title</title> <point>This is a demo</point> <point>Of a program for processing slides</point> </slide> <slide><title>Another demo slide</title> ... <point>It is important</point> <point>To have more than</point> <point>one slide</point> </slide> </slideshow> """ dom = xml . do ... : handleSlide ( slide ) def handleSlide ( slide ): handleSlideTitle ( slide . getElementsByTagName ( "title" )[ 0 ]) handlePoints ( slide . getElementsByTagName ( "point" )) def handleSlideshowTitle ( title ): print ( f "<title> { getText ( title . ch ...
https://man.mtool.work/python/3.14/library/xml.dom.minidom.html
sqlite3 --- SQLite データベース用の DB-API 2.0 インターフェース 11592
sqlite3 --- SQLite データベース用の DB-API 2.0 インターフェース ソースコード: Lib/sqlite3/ SQLite は、軽量なディスク上のデータベースを提供する C ライブラリです。別のサーバプロセスを用意する必要なく、 SQL クエリー言語の非標準的な一種を使用し ... 用して、変換関数を探します。例えば: CREATE TABLE test ( i integer primary key , ! will look up a converter named "integer" p point , ! will look up a converter named "point" n number ( 10 ) ! will look up a converter named "number" ) このフラグは | (ビッ ... を検索します。 クエリの列名はダブルクォート ( " ) で囲み、型名は角括弧 ( [] ) で囲む必要があります。 SELECT MAX ( p ) as "p [point]" FROM test ; ! will look up converter "point" このフラグは | (ビット論理和)演算子を使用して PARSE_DECLTYPES と組み合わせる ... "SELECT rowid, name, ingredients FROM recipe WHERE name MATCH 'pie'" ): print ( row ) load_extension ( path , / , * , entrypoint = None ) 共有ライブラリから SQLite 拡張機能(extension)をロードします。このメソッドを呼び出す前に enable_load_extension() で ...
https://man.mtool.work/python/3.14/library/sqlite3.html
ctypes --- Python 用の外部関数ライブラリ 10860
ctypes --- Python 用の外部関数ライブラリ ソースコード: Lib/ctypes ctypes は Python 用の外部関数ライブラリです。 C と互換性のあるデータ型を提供し、DLL や共有ライブラリの関数を呼び出せます。 これらのライブラリを純粋な Python でラップするために ... があります。 >>> libc . time . restype = c_time_t 引数の型は argtypes を使って指定できます。 >>> libc . time . argtypes = ( POINTER ( c_time_t ),) 第 1 引数に NULL ポインタを渡して関数を呼び出すには、 None を使います。 >>> print ( libc . time ( None )) ... >>> strchr = libc . strchr >>> strchr ( b "abcdef" , ord ( "d" )) 8059983 >>> strchr . restype = c_char_p # c_char_p is a pointer to a string >>> strchr ( b "abcdef" , ord ( "d" )) b'def' >>> print ( strchr ( b "abcdef" , ord ( "x" ))) None >>> 上の例 ... これは パラメータの参照渡し としても知られています。 ctypes は、引数を参照渡しするための byref() 関数をエクスポートします。 pointer() 関数でも同じ効果を得られますが、 pointer() は実際のポインタオブジェクトを構築するため、より多くの処理を行います。 Pyth ...
https://man.mtool.work/python/3.14/library/ctypes.html
collections --- コンテナデータ型 10348
collections --- コンテナデータ型 ソースコード: Lib/collections/__init__.py このモジュールは、汎用の Python 組み込みコンテナ dict , list , set , および tuple に代わる、特殊なコンテナデータ型を実装しています。 namedtuple() 名前付きフィールドを ... 属性が削除されました。 バージョン 3.7 で変更: defaults 引数と _field_defaults 属性が追加されました。 >>> # 基本的な例 >>> Point = namedtuple ( 'Point' , [ 'x' , 'y' ]) >>> p = Point ( 11 , y = 22 ) # 位置引数またはキーワード引数でインスタンスを作成 > ... >>> x , y (11, 22) >>> p . x + p . y # フィールドには名前でもアクセス可能 33 >>> p # name=value 形式の読みやすい __repr__ Point(x=11, y=22) 名前付きタプルは csv や sqlite3 モジュールが返すタプルのフィールドに名前を付けるときにとても便利です: Employee ... le. _make ( iterable , / ) 既存の sequence や Iterable から新しいインスタンスを作るクラスメソッド. >>> t = [ 11 , 22 ] >>> Point . _make ( t ) Point(x=11, y=22) somenamedtuple. _asdict ( ) フィールド名を対応する値にマッピングする新しい dict を返します ...
https://man.mtool.work/python/3.14/library/collections.html
What's New In Python 3.10 10348
What's New In Python 3.10 編集者 : Pablo Galindo Salgado この記事では Python 3.9 と比較した Python 3.10 の新機能を解説します。Python 3.10 は2021年10月4日にリリースされました。全詳細については 変更履歴 をご覧ください。 概要 -- リリースハイラ ... 数をバインドするために使用することもできます。次の例では、データポイントを展開して、その x 座標と y 座標を取得しています: # point は (x, y) のタプル match point : case ( 0 , 0 ): print ( "Origin" ) case ( 0 , y ): print ( f "Y= { y } " ) case ( x , 0 ) ... : print ( f "X= { x } " ) case ( x , y ): print ( f "X= { x } , Y= { y } " ) case _ : raise ValueError ( "Not a point" ) 最初のパターン (0, 0) は 2 つのリテラルから構成されており、上で示したリテラルパターン拡張と考えることができます。次の 2 ... つのパターンでは、リテラルと変数が組み合わされており、変数は対象( point )から値を取り出して変数にバインドします。4 番目のパターンは 2 つの値を同時に取得しており、これはアンパック代入 (x, y) = p ...
https://man.mtool.work/python/3.14/whatsnew/3.10.html
dataclasses --- データクラス 7977
dataclasses --- データクラス ソースコード: Lib/dataclasses.py このモジュールは、 __init__() や __repr__() のような 特殊メソッド を生成し、ユーザー定義のクラスに自動的に追加するデコレーターや関数を提供します。このモジュールは元々、 PEP 557 で ... Other objects are copied with copy.deepcopy() . 入れ子になったデータクラスに asdict() を使用する例です。 @dataclass class Point : x : int y : int @dataclass class C : mylist : list [ Point ] p = Point ( 10 , 20 ) assert asdict ( p ) == { 'x' : 10 , ' ... y' : 20 } c = C ([ Point ( 0 , 0 ), Point ( 10 , 4 )]) assert asdict ( c ) == { 'mylist' : [{ 'x' : 0 , 'y' : 0 }, { 'x' : 10 , 'y' : 4 }]} 浅いコピ ... as keywords when the class is instantiated. このサンプルでは y と z がキーワード専用フィールドとなります: @dataclass class Point : x : float _ : KW_ONLY y : float z : float p = Point ( 0 , y = 1.5 , z = 2.0 ) 単一のデータクラス内で、型が KW_ONLY のフィ ...
https://man.mtool.work/python/3.14/library/dataclasses.html
Python 3.15 で削除予定 7874
Python 3.15 で削除予定 インポートシステム: Setting __cached__ on a module while failing to set __spec__.cached is deprecated. In Python 3.15, __cached__ will cease to be set or take into consideration by the import system or standard librar ... ラリは __package__ を設定しなくなり、その値も参照しなくなります。 ( gh-97879 ) ctypes : ドキュメント化されていない ctypes.SetPointerType() 関数は Python 3.13 から非推奨です。 http.server : The obsolete and rarely used CGIHTTPRequestHandler has been depr ... a Sobolev in gh-101866 .) typing : NamedTuple クラスを作成する、ドキュメント化されていないキーワード引数による構文 (例えば Point = NamedTuple("Point", x=int, y=int) ) は Python 3.13 から非推奨です。 代わりにクラスベースの構文か関数形式の構文を使ってく ...
https://man.mtool.work/python/3.14/deprecations/pending-removal-in-3.15.html
Logging クックブック 7567
Logging クックブック Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に有用であるとされていた、logging に関連するいくつものレシピを含んでいます。チュートリアルやリファレンス情報へのリンクについては その他のリソース ... age as __ >>> print ( __ ( 'Message with {0} {name} ' , 2 , name = 'placeholders' )) Message with 2 placeholders >>> class Point : pass ... >>> p = Point () >>> p . x = 0.5 >>> p . y = 0.5 >>> print ( __ ( 'Message with coordinates: ( {point.x:.2f} , ... {point.y:.2f} )' , ... point = p )) Message with coordinates: (0.50, 0.50) >>> from wherever import DollarMessage as __ >>> print ... > __ = BraceMessage >>> print ( __ ( 'Message with {0} {1} ' , 2 , 'placeholders' )) Message with 2 placeholders >>> class Point : pass ... >>> p = Point () >>> p . x = 0.5 >>> p . y = 0.5 >>> print ( __ ( 'Message with coordinates: ( {point.x:.2f} , ...
https://man.mtool.work/python/3.14/howto/logging-cookbook.html
tkinter.font --- Tkinter フォントラッパー 7567
tkinter.font --- Tkinter フォントラッパー ソースコード: Lib/tkinter/font.py tkinter.font モジュールは、名前付きフォントの作成と利用のために Font クラスを提供します。 フォントの太さと傾きには次の種類があります: tkinter.font. NORMAL tkinter.f ... ると、そのメトリックの値を整数で返します。 オプションには次のものがあります: ascent - distance between baseline and highest point that a character of the font can occupy descent - distance between baseline and lowest point that a character of the font ...
https://man.mtool.work/python/3.14/library/tkinter.font.html
PREV 1 2 3 4 5 6 NEXT