Results of 1 - 10 of about 61 for Match (0.010 sec.)
- re --- 正規表現操作 14510
- re --- 正規表現操作 ソースコード: Lib/re/ このモジュールは Perl に見られる正規表現マッチング操作と同様のものを提供します。 パターンおよび検索される文字列には、Unicode 文字列 ( str ) や 8 ビット文字列 ( bytes ) を使います。ただし、Unicode 文
...追加の機能とより充実した Unicode サポートを提供します。 Regular Expression Syntax 正規表現 (または RE) は、その表現にマッチ (match) する文字列の集合を指定します。このモジュールの関数を使えば、ある文字列が与えられた正規表現にマッチするか (または、与えられ...a{3,5} は、5 個の 'a' 文字にマッチしますが、 a{3,5}? は 3 個の文字にマッチするだけです。 {m,n}+ Causes the resulting RE to match from m to n repetitions of the preceding RE, attempting to match as many repetitions as possible without establishing any...is the possessive version of the quantifier above. For example, on the 6-character string 'aaaaaa' , a{3,5}+aa attempt to match 5 'a' characters, then, requiring 2 more 'a' s, will need more characters than available and thus fail, while a{3,5}aa wil... - https://man.mtool.work/python/3.14/library/re.html
- 正規表現 HOWTO 13524
- 正規表現 HOWTO Author : A.M. Kuchling < amk @ amk . ca > 概要 このドキュメントは re モジュールを使って Python で正規表現を扱うための導入のチュートリアルです。ライブラリレファレンスの正規表現の節よりもやさしい入門ドキュメントを用意しています
...す。ここでは、その中でも最も重要なものについて扱います; 完全なリストは re ドキュメントを参照して下さい。 メソッド/属性 目的 match() Determine if the RE matches at the beginning of the string. search() 文字列を先頭から走査して、正規表現がどこにマッチする...文字列をすべて見つけ、リストで返します。 finditer() 正規表現にマッチする部分文字列をすべて見つけ、 iterator として返します。 match() and search() return None if no match can be found. If they're successful, a match object instance is returned, containin...g information about the match: where it starts and ends, the substring it matched, and more. re モジュールを対話的に試すと理解が深まります。 この HOWTO... - https://man.mtool.work/python/3.14/howto/regex.html
- ast --- 抽象構文木 10422
- ast --- 抽象構文木 ソースコード: Lib/ast.py ast モジュールは、Python の抽象構文を表す木を Python アプリケーションで処理するための機能を提供します。 抽象構文自体は Python のリリースごとに変わる可能性がありますが、このモジュールを使えば、現在
...m * items , stmt * body , string ? type_comment ) | AsyncWith ( withitem * items , stmt * body , string ? type_comment ) | Match ( expr subject , match_case * cases ) | Raise ( expr ? exc , expr ? cause ) | Try ( stmt * body , excepthandler * handlers...ineno , int col_offset , int ? end_lineno , int ? end_col_offset ) withitem = ( expr context_expr , expr ? optional_vars ) match_case = ( pattern pattern , expr ? guard , stmt * body ) pattern = MatchValue ( expr value ) | MatchSingleton ( constant va...lue ) | MatchSequence ( pattern * patterns ) | MatchMapping ( expr * keys , pattern * patterns , identifier ? rest ) | MatchClass ( expr... - https://man.mtool.work/python/3.14/library/ast.html
- 8. 複合文 (compound statement) 8682
- 8. 複合文 (compound statement) 複合文には、他の文 (のグループ) が入ります; 複合文は、中に入っている他の文の実行の制御に何らかのやり方で影響を及ぼします。一般的には、複合文は複数行にまたがって書かれますが、全部の文を一行に連ねた単純な書き方も
...); print ( z ) まとめると、以下のようになります: compound_stmt : if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | match_stmt | funcdef | classdef | async_with_stmt | async_for_stmt | async_funcdef suite : stmt_list NEWLINE | NEWLINE INDENT st...けるようになりました。 参考 PEP 343 - "with" ステートメント Python の with 文の仕様、背景、および例が記載されています。 8.6. match 文 Added in version 3.10. match 文はパターンマッチングを行う目的で使われます。 構文: match_stmt : 'match' subject_expr ":"...用符で囲まれているものは ソフトキーワード を表します。 パターンマッチングは、パターン ( case の後ろ) とマッチング対象の値 ( match の後ろ)を入力とします。 パターン (サブパターンを含みうる) は、マッチング対象の値に対して、マッチするかどうかの判定が行われ... - https://man.mtool.work/python/3.14/reference/compound_stmts.html
- 10. 完全な文法仕様 8682
- 10. 完全な文法仕様 以下は Python の完全な文法で、CPython のパーサを生成するための文法から直接得たものです ( Grammar/python.gram を参照)。 ここでは、コード生成とエラー回復に関する詳細を省略しています。 ここで使う記法は、これまでのドキュメント
...return_type]: expression # If the return type is omitted, then a void * is returned in C and an Any in # Python. # e1 e2 # Match e1, then match e2. # e1 | e2 # Match e1 or e2. # The first alternative can also appear on the line after the rule name for...a | must be used before the first # alternative, like so: # rule_name[return_type]: # | first_alt # | second_alt # ( e ) # Match e (allows also to use other operators in the group like '(e)*') # [ e ] or e? # Optionally match e. # e* # Match zero or m...ore occurrences of e. # e+ # Match one or more occurrences of e. # s.e+ # Match one or more occurrences of e, separated by s. The generated parse tree # does... - https://man.mtool.work/python/3.14/reference/grammar.html
- pathlib --- オブジェクト指向のファイルシステムパス 8465
- pathlib --- オブジェクト指向のファイルシステムパス Added in version 3.4. ソースコード: Lib/pathlib/ このモジュールはファイルシステムのパスを表すクラスを提供していて、様々なオペレーティングシステムについての適切な意味論をそれらのクラスに持た
.../apache2') >>> PureWindowsPath ( 'c:' ) . joinpath ( '/Program Files' ) PureWindowsPath('c:/Program Files') PurePath. full_match ( pattern , * , case_sensitive = None ) 現在のパスが glob 形式で与えられたパターンと一致したら True を、一致しなければ Fal...se を返します。例: >>> PurePath ( 'a/b.py' ) . full_match ( 'a/*.py' ) True >>> PurePath ( 'a/b.py' ) . full_match ( '*.py' ) False >>> PurePath ( '/a/b/c.py' ) . full_match ( '**/...*.py' ) True >>> PurePath ( '/a/b/c.py' ) . full_match ( '/a/**' ) True Patterns ending in " /** ", as in the example above, may surprise when passed to full_match . Even though... - https://man.mtool.work/python/3.14/library/pathlib.html
- difflib --- 差分の計算の補助 8349
- difflib --- 差分の計算の補助 ソースコード: Lib/difflib.py このモジュールはシーケンスを比較するクラスと関数を提供します。 その多くは、テキスト行のシーケンス (文字列のリストや ファイルオブジェクト など) を比較し、相違点を報告する 差分 (diff)
...t diff などのツールが生成するコンテキスト形式やユニファイド形式など、さまざまな形式の差分を生成できます。 比較には SequenceMatcher に実装されたマッチングアルゴリズムを使います。 この柔軟なクラスは、要素が hashable であれば、テキストに限らず任意の型のシ...tems that account for more than 1% it are considered junk . データによっては、このヒューリスティックを無効にする ( SequenceMatcher の autojunk 引数を False にする) か、 isjunk 引数で調整することを検討してください。 isjunk には 定義済みの関数 のいずれか...を指定することもできます。 difflib のアルゴリズム SequenceMatcher のアルゴリズムは、Ratcliff と Obershelp が 1980 年代後半に「ゲシュタルトパターンマッチング」という大げさな名前で発表した... - https://man.mtool.work/python/3.14/library/difflib.html
- 4. その他の制御フローツール 8088
- 4. その他の制御フローツール 前章で紹介した while 文の他にも、 Python にはいくつか制御フローツールがあり、本章で説明します。 4.1. if 文 おそらく最もおなじみの文型は if 文でしょう。例えば: >>> x = int ( input ( "Please enter an integer: " ))
...の言語における switch 文や case 文の代用となります。 同じ値を複数の定数と比較する場合や、特定の型や属性を確認する場合には、 match 文も便利です。詳細は match 文 を参照してください。 4.2. for 文 Python の for 文は、読者が C 言語や Pascal 言語で使いなれて...でも使えます)が、 ... は慣例的にプレースホルダ本体としても使われています。 Ellipsis オブジェクト を参照してください。 4.7. match 文 match 文は式を受け取り、その値を1つ以上の case ブロックに指定されたパターンと順に比較します。表面的には C、Java、JavaSc...ければ、どの分岐も実行されません。 最も単純な形式では、対象の値を1つ以上のリテラルと比較します。 def http_error ( status ): match status : case 400 : return "Bad request" case 404 : return "Not found" case 418 : return "I'm a teapot" case _ : return "S... - https://man.mtool.work/python/3.14/tutorial/controlflow.html
- fnmatch --- Unix のファイル名パターンマッチ 7972
- fnmatch --- Unix のファイル名パターンマッチ ソースコード: Lib/fnmatch.py このモジュールは Unix のシェル形式のワイルドカードに対応しています。これらは、 ( re モジュールでドキュメント化されている) 正規表現とは 異なります 。シェル形式のワイルド
...tools.lru_cache with a maxsize of 32768 is used to cache the (typed) compiled regex patterns in the following functions: fnmatch() , fnmatchcase() , filter() , filterfalse() . fnmatch. fnmatch ( name , pat ) ファイルの文字列 name がパターン文字列 pat...字が正規化されます。オペレーティングシステムが標準でどうなっているかに関係なく、大文字、小文字を区別して比較する場合には、 fnmatchcase() が使用できます。 次の例では、カレントディレクトリにある、拡張子が .txt である全てのファイルを表示しています: import...fnmatch import os for file in os . listdir ( '.' ): if fnmatch . fnmatch ( file , '*.txt' ): print ( file ) fnmatch. fnmatchcase (... - https://man.mtool.work/python/3.14/library/fnmatch.html
- What's New In Python 3.10 7914
- What's New In Python 3.10 編集者 : Pablo Galindo Salgado この記事では Python 3.9 と比較した Python 3.10 の新機能を解説します。Python 3.10 は2021年10月4日にリリースされました。全詳細については 変更履歴 をご覧ください。 概要 -- リリースハイラ
...from offset to line number should use the new co_lines() method instead. PEP 634: 構造的パターンマッチ Structural pattern matching has been added in the form of a match statement and case statements of patterns with associated actions. Patterns consi...st of sequences, mappings, primitive data types as well as class instances. Pattern matching enables programs to extract information from complex data types, branch on the structure of data, and apply specific ac...tions based on different forms of data. 構文と演算 パターンマッチングの一般的な構文は次のとおりです: match subject : case < pattern_1 > : < action_1 > case < pattern_2 > : < action_2 > case < pattern_3 > : < action_3 > case _ : <... - https://man.mtool.work/python/3.14/whatsnew/3.10.html