per page, with , order by , clip by
Results of 1 - 10 of about 57 for split (0.009 sec.)
shlex --- 単純な字句解析 14009
shlex --- 単純な字句解析 ソースコード: Lib/shlex.py shlex クラスは Unix シェルに似た、単純な構文に対する字句解析器を簡単に書けるようにします。 このクラスはしばしば、 Python アプリケーションのための実行制御ファイルのような小規模言語を書く場合 ... や、引用符で囲まれた文字列を解析する場合に便利です。 shlex モジュールは以下の関数を定義します。 shlex. split ( s , comments = False , posix = True ) シェルに似た文法を使って、文字列 s を分割します。 comments が False (デフォルト値) ... ージョン 3.12 で変更: s 引数に None を渡すと、 sys.stdin から読み込む代わりに例外を送出するようになりました。 shlex. join ( split_command ) リスト split_command のトークンを連結して文字列を返します。 この関数は split() の逆の操作を行います。 >>> from s ... command )) >>> print ( remote_command ) ssh home 'ls -l '"'"'somefile; rm -rf ~'"'"'' クォーティングは UNIX シェルならびに split() と互換です: >>> from shlex import split >>> remote_command = split ( remote_command ) >>> remote_command ['ssh', 'home', ...
https://man.mtool.work/python/3.14/library/shlex.html
組み込み型 11953
組み込み型 以下のセクションでは、インタプリタに組み込まれている標準型について記述します。 主要な組み込み型は、数値、シーケンス、マッピング、クラス、インスタンス、および例外です。 コレクションクラスには、ミュータブルなものがあります。コレクシ ... bytes.startswith() str.endswith() bytes.endswith() str.count() bytes.count() str.replace() bytes.replace() 分割と結合 str.split() str.rsplit() bytes.split() bytes.rsplit() str.splitlines() bytes.splitlines() str.partition() bytes.partition() str.rpar ... ようになります: >>> ', ' . join ([ 'spam' , 'spam' , 'spam' ]) 'spam, spam, spam' >>> '-' . join ( 'Python' ) 'P-y-t-h-o-n' split() も参照してください。 str. ljust ( width , fillchar = ' ' , / ) 長さ width の左揃えした文字列を返します。パディングは指定 ... g", ' ', 'Circus') >>> 'Monty Python' . rpartition ( '-' ) ('', '', 'Monty Python') partition() も参照してください。 str. rsplit ( sep = None , maxsplit = -1 ) 区切り文字列として sep を使い、文字列内の単語のリストを返します。 maxsplit を指定した場合は ...
https://man.mtool.work/python/3.14/builtins/stdtypes.html
argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー 11219
argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー Added in version 3.2. ソースコード: Lib/argparse.py 注釈 argparse は基本的なコマンドラインアプリケーションの実装に推奨される標準ライブラリのモジュールですが、動作を厳密 ... '-+' ) >>> parser . add_argument ( '+f' ) >>> parser . add_argument ( '++bar' ) >>> parser . parse_args ( '+f X ++bar Y' . split ()) Namespace(bar='Y', f='X') prefix_chars= 引数のデフォルトは '-' です。 - を含まない文字セットを指定すると、 -f/--foo オ ... ault=None, type=<class 'int'>, choices=None, help=None, metavar=None) >>> try : ... parser . parse_args ( '--integers a' . split ()) ... except argparse . ArgumentError : ... print ( 'Catching an argumentError' ) ... Catching an argumentError Added in ... = 'store_false' ) >>> parser . add_argument ( '--baz' , action = 'store_false' ) >>> parser . parse_args ( '--foo --bar' . split ()) Namespace(foo=True, bar=False, baz=True) These defaults apply when the options are absent. They can be overridden by d ...
https://man.mtool.work/python/3.14/library/argparse.html
正規表現 HOWTO 10925
正規表現 HOWTO Author : A.M. Kuchling < amk @ amk . ca > 概要 このドキュメントは re モジュールを使って Python で正規表現を扱うための導入のチュートリアルです。ライブラリレファレンスの正規表現の節よりもやさしい入門ドキュメントを用意しています ... 正規表現は文字列を様々な方法で変更するのにもよく使われます。変更には以下のパターンメソッドが利用されます: メソッド/属性 目的 split() 文字列をリストに分割する、正規表現がマッチした全ての場所で分割を行う sub() 正規表現にマッチした全ての文字列を発見し、別の ... 文字列に置き換えます subn() sub() と同じことをしますが、新しい文字列と置き換えの回数を返します 文字列の分割 パターンの split() メソッドは、正規表現がマッチする箇所で文字列を分割し、各部分のリストを返します。 文字列の split() に似ていますが、区切り ... の指定にはずっと自由度があります。 文字列の split() は空白か固定文字列でしか分割できません。 モジュールレベルの re.split() 関数もあります。 . split ( string [ , maxsplit=0 ...
https://man.mtool.work/python/3.14/howto/regex.html
re --- 正規表現操作 10059
re --- 正規表現操作 ソースコード: Lib/re/ このモジュールは Perl に見られる正規表現マッチング操作と同様のものを提供します。 パターンおよび検索される文字列には、Unicode 文字列 ( str ) や 8 ビット文字列 ( bytes ) を使います。ただし、Unicode 文 ... 現の動作を変更できます。 flags の各変数を、ビット単位 OR ( | 演算子) で組み合わせて指定できます。 Added in version 3.4. re. split ( pattern , string , maxsplit = 0 , flags = 0 ) string を、出現した pattern で分割します。 pattern 中でキャプチャの丸括弧が ... 使われていれば、パターン中の全てのグループのテキストも結果のリストの一部として返されます。 maxsplit が 0 でなければ、分割は最大 maxsplit 回起こり、残りの文字列はリストの最終要素として返されます。 >>> re . split ( r '\W+' , ... 'Words, words, words.' ) ['Words', 'words', 'words', ''] >>> re . split ( r '(\W+)' , 'Words, words, words.' ) ['Words', ', ', 'words', ', ', 'words', '.', ''] >>> re . split ( r '\W+' , 'Words, ...
https://man.mtool.work/python/3.14/library/re.html
getopt --- C 形式のコマンドラインオプション解析 9031
getopt --- C 形式のコマンドラインオプション解析 ソースコード: Lib/getopt.py 注釈 このモジュールは機能が完成したものとされています。 この API より宣言的で拡張しやすい代替手段として、 optparse モジュールがあります。 コマンドライン引数処理のさ ... のために残されています。 Unix スタイルのオプションを使った例です: >>> import getopt >>> args = '-a -b -cfoo -d bar a1 a2' . split () >>> args ['-a', '-b', '-cfoo', '-d', 'bar', 'a1', 'a2'] >>> optlist , args = getopt . getopt ( args , 'abc:d:' ) >>> op ... '] 長形式のオプションを使っても同様です: >>> s = '--condition=foo --testing --output-file abc.def -x a1 a2' >>> args = s . split () >>> args ['--condition=foo', '--testing', '--output-file', 'abc.def', '-x', 'a1', 'a2'] >>> optlist , args = getopt . g ... ', 'a2'] 省略可能な引数は、次のように明示的に指定してください。 >>> s = '-Con -C --color=off --color a1 a2' >>> args = s . split () >>> args ['-Con', '-C', '--color=off', '--color', 'a1', 'a2'] >>> optlist , args = getopt . getopt ( args , 'C::' , [ ' ...
https://man.mtool.work/python/3.14/library/getopt.html
chunk --- IFF チャンクデータの読み込み 8444
chunk --- IFF チャンクデータの読み込み バージョン 3.11 で非推奨、バージョン 3.13 で削除. このモジュールは今や Python 標準ライブラリの一部ではありません。このモジュールは Python 3.11 で非推奨となったあと、 Python 3.13 で削除 されました。削除 ... です。 他のマニュアルの関連ページ PHP stream_set_chunk_size() PHP array_chunk() PHP threaded.chunk Django uploads PHP chunk_split() PHP taint.requirements ...
https://man.mtool.work/python/3.14/library/chunk.html
組み込み例外 8003
組み込み例外 Python において、すべての例外は BaseException から派生したクラスのインスタンスでなければなりません。特定のクラスを言及する except 節を伴う try 文において、その節はそのクラスから派生した例外クラスも処理しますが、そのクラスの派生 ... ます。 Added in version 3.13: condition に、型オブジェクト以外の任意の呼び出し可能オブジェクトを指定できるようになりました。 split ( condition ) subgroup() と似てますが (match, rest) のペアを返します。 match は subgroup(condition) で rest は残りのマッチ ... 返しますが、 excs の例外を含んでいます。 このメソッドは、さまざまな状況で例外グループを分割するために使われる subgroup() と split() から呼び出されます。 サブクラスで subgroup() と split() が ExceptionGroup ではなくそのサブクラスのインスタンスを返すよう ... にするには、 このメソッドをオーバーライドする必要があります。 subgroup() と split() は __traceback__ 、 __cause__ 、 __context__ と __notes__ フィールドを元の例外グループから derive() が返す例外グループに ...
https://man.mtool.work/python/3.14/builtins/exceptions.html
unittest --- ユニットテストフレームワーク 7856
unittest --- ユニットテストフレームワーク ソースコード: Lib/unittest/__init__.py (すでにテストの基本概念について詳しいようでしたら、この部分をとばして アサートメソッド一覧 に進むと良いでしょう。) unittest ユニットテストフレームワークは、もと ... OO' ) def test_isupper ( self ): self . assertTrue ( 'FOO' . isupper ()) self . assertFalse ( 'Foo' . isupper ()) def test_split ( self ): s = 'hello world' self . assertEqual ( s . split (), [ 'hello' , 'world' ]) # 区切りが文字列でない場合に s.split ... が失敗することを確認する with self . assertRaises ( TypeError ): s . split ( 2 ) if __name__ == '__main__' : unittest . main () テストケースは、 unittest.TestCase のサブクラスとして作成します。メソ ... ain() はより冗長になり、以下のような出力をします: test_isupper ( __main__ . TestStringMethods . test_isupper ) ... ok test_split ( __main__ . TestStringMethods . test_split ) ... ok test_upper ( __main__ . TestStringMethods . test_upper ) ... ok ----- ...
https://man.mtool.work/python/3.14/library/unittest.html
os.path --- 一般的なパス名操作 7577
os.path --- 一般的なパス名操作 ソースコード: Lib/genericpath.py , Lib/posixpath.py (POSIX) 、 Lib/ntpath.py (Windows) 。 このモジュールはパス名を扱う際に便利な関数を実装しています。ファイルの読み書きをする際は open() を、ファイルシステムにア ... ect を受け入れるようになりました。 os.path. basename ( path , / ) パス名 path の末尾のファイル名部分を返します。これは関数 split() に path を渡した時に返されるペアの 2 番めの要素です。この関数が返すのは Unix の basename とは異なります; Unix の basenam ... ike object を受け入れるようになりました。 os.path. dirname ( path , / ) パス名 path のディレクトリ名を返します。これは関数 split() に path を渡した時に返されるペアの 1 番めの要素です。 バージョン 3.6 で変更: path-like object を受け入れるようになりまし ... と sameopenfile() が内部で使う比較処理を実装しています。 バージョン 3.4 で変更: Windows サポートを追加しました。 os.path. split ( path , / ) パス名 path を (head, tail) のペアに分割します。 tail はパス名の最後の要素で、 head はそれより前のすべての部分 ...
https://man.mtool.work/python/3.14/library/os.path.html
PREV 1 2 3 4 5 6 NEXT