per page, with , order by , clip by
Results of 1 - 10 of about 20 for words (0.006 sec.)
re --- 正規表現操作 14053
re --- 正規表現操作 ソースコード: Lib/re/ このモジュールは Perl に見られる正規表現マッチング操作と同様のものを提供します。 パターンおよび検索される文字列には、Unicode 文字列 ( str ) や 8 ビット文字列 ( bytes ) を使います。ただし、Unicode 文 ... が 0 でなければ、分割は最大 maxsplit 回起こり、残りの文字列はリストの最終要素として返されます。 >>> re . split ( r '\W+' , 'Words, words, words.' ) ['Words', 'words', 'words', ''] >>> re . split ( r '(\W+)' , 'Words, words, words.' ) ['Words', ', ', 'w ... ords', ', ', 'words', '.', ''] >>> re . split ( r '\W+' , 'Words, words, words.' , maxsplit = 1 ) ['Words', 'words, words.'] >>> re . split ( ... 列の先頭にマッチするなら、結果は空文字列で始まります。 同じことが文字列の末尾にも言えます。 >>> re . split ( r '(\W+)' , '...words, words...' ) ['', '...', 'words', ', ', 'words', '...', ''] そうして、結果のリストにおいて、セパレータの構成要素は常に同じ ...
https://man.mtool.work/python/3.14/library/re.html
正規表現 HOWTO 11674
正規表現 HOWTO Author : A.M. Kuchling < amk @ amk . ca > 概要 このドキュメントは re モジュールを使って Python で正規表現を扱うための導入のチュートリアルです。ライブラリレファレンスの正規表現の節よりもやさしい入門ドキュメントを用意しています ... ュールレベル関数 re.split() は最初の引数に利用する正規表現を追加しますが、それ以外は同じです。 >>> 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, words, words.' , 1 ) ['Words', 'words, words.'] 検索と置換 ...
https://man.mtool.work/python/3.14/howto/regex.html
textwrap --- テキストの折り返しと詰め込み 10689
textwrap --- テキストの折り返しと詰め込み ソースコード: Lib/textwrap.py textwrap モジュールは、実際の処理をすべて担う TextWrapper クラスと、いくつかの便利な関数を提供します。 1 つか 2 つの文字列を折り返したり詰め込んだりするだけなら、これら ... = '' , subsequent_indent = '' , expand_tabs = True , replace_whitespace = True , fix_sentence_endings = False , break_long_words = True , drop_whitespace = True , break_on_hyphens = True , tabsize = 8 , max_lines = None , placeholder = ' [...]' ) text ... = '' , subsequent_indent = '' , expand_tabs = True , replace_whitespace = True , fix_sentence_endings = False , break_long_words = True , drop_whitespace = True , break_on_hyphens = True , tabsize = 8 , max_lines = None , placeholder = ' [...]' ) text ... く同じ名前のキーワード引数を受け取ります。 textwrap. shorten ( text , width , * , fix_sentence_endings = False , break_long_words = True , break_on_hyphens = True , placeholder = ' [...]' ) 与えられた text を折りたたみ、切り詰めて、与えられた width に収 ...
https://man.mtool.work/python/3.14/library/textwrap.html
secrets --- 機密を扱うために安全な乱数を生成する 9703
secrets --- 機密を扱うために安全な乱数を生成する Added in version 3.6. ソースコード: Lib/secrets.py secrets モジュールは、パスワード、アカウント認証、セキュリティトークン、その他の機密情報の管理に適した、暗号学的に強い乱数を生成するために使 ... 書ファイルを使う。 # 他のプラットフォームでは、単語リストを自分で用意する必要がある場合がある。 with open ( '/usr/share/dict/words' ) as f : words = [ word . strip () for word in f ] password = ' ' . join ( secrets . choice ( words ) for i in range ( 4 ...
https://man.mtool.work/python/3.14/library/secrets.html
email.policy: ポリシーオブジェクト 8445
email.policy : ポリシーオブジェクト Added in version 3.3. ソースコード: Lib/email/policy.py email パッケージの主な目的は、メールや MIME に関する各種 RFC に従ってメールメッセージを扱うことです。 しかし、メールの一般的な形式はメール以外の用途 ... rsion 3.6: [ 1 ] utf8 If False , follow RFC 5322 , supporting non-ASCII characters in headers by encoding them as "encoded words". If True , follow RFC 6532 and use utf-8 encoding for headers. Messages formatted in this way may be passed to SMTP serve ... に準拠した \r\n に設定されています。 email.policy. SMTPUTF8 utf8 が True である点を除き、 SMTP と同じです。 ヘッダに encoded words を使わず、メッセージの保存先にシリアライズするのに便利です。 SMTP 送信では、送信者または受信者のアドレスに非 ASCII 文字が含 ... 折り返し直されるヘッダには、RFC の折り返しアルゴリズムを完全に実装したアルゴリズムが使われます。 このアルゴリズムは encoded words が必要な位置と許可される位置も判断します。 アプリケーション側から見ると、 EmailMessage から取得するヘッダはすべて追加の属性 ...
https://man.mtool.work/python/3.14/library/email.policy.html
shlex --- 単純な字句解析 8156
shlex --- 単純な字句解析 ソースコード: Lib/shlex.py shlex クラスは Unix シェルに似た、単純な構文に対する字句解析器を簡単に書けるようにします。 このクラスはしばしば、 Python アプリケーションのための実行制御ファイルのような小規模言語を書く場合 ... します。 この関数は split() の逆の操作を行います。 >>> from shlex import join >>> print ( join ([ 'echo' , '-n' , 'Multiple words' ])) echo -n 'Multiple words' 戻り値には、インジェクション脆弱性を防ぐためにシェルのエスケープ処理を施します ( quote() を参 ...
https://man.mtool.work/python/3.14/library/shlex.html
4. その他の制御フローツール 7885
4. その他の制御フローツール 前章で紹介した while 文の他にも、 Python にはいくつか制御フローツールがあり、本章で説明します。 4.1. if 文 おそらく最もおなじみの文型は if 文でしょう。例えば: >>> x = int ( input ( "Please enter an integer: " )) ... たは文字列) にわたって反復を行います。反復の順番はシーケンス中に要素が現れる順番です。例えば: >>> # 文字列の長さを計測: >>> words = [ 'cat' , 'window' , 'defenestrate' ] >>> for w in words : ... print ( w , len ( w )) ... cat 3 window 6 defenestrate 12 ... name より前になければなりません)。 例えば、ある関数の定義を以下のようにすると: def cheeseshop ( kind , * arguments , ** keywords ): print ( "-- Do you have any" , kind , "?" ) print ( "-- I'm sorry, we're all out of" , kind ) for arg in arguments : pr ... int ( arg ) print ( "-" * 40 ) for kw in keywords : print ( kw , ":" , keywords [ kw ]) 呼び出しは以下のようになり: cheeseshop ( "Limburger" , "It's very runny, sir." , "It ...
https://man.mtool.work/python/3.14/tutorial/controlflow.html
Call プロトコル 7732
Call プロトコル CPython は tp_call と vectorcall の二つの呼び出しプロトコルをサポートしています。 tp_call プロトコル tp_call を設定したクラスのインスタンスは呼び出し可能です。 このスロットのシグネチャは次のとおりです。 PyObject * tp_call ( ... uments from nargsf , use PyVectorcall_NARGS() . kwnames is a tuple containing the names of the keyword arguments; in other words, the keys of the kwargs dict. These names must be strings (instances of str or a subclass) and they must be unique. If the ...
https://man.mtool.work/python/3.14/c-api/call.html
ソートのテクニック 7732
ソートのテクニック Author : Andrew Dalke and Raymond Hettinger Python のリストにはリストをインプレースに変更する、組み込みメソッド list.sort() があります。他にもイテラブルからソートしたリストを作成する組み込み関数 sorted() があります。 この ... 処するため、Python は比較関数をラップしてキー関数として使えるようにする関数 functools.cmp_to_key を提供しています。 sorted ( words , key = cmp_to_key ( strcoll )) # ロケールに応じたソート順 順序を比較できない型や値への対処 ソートでは、型や値に関する問題 ...
https://man.mtool.work/python/3.14/howto/sorting.html
argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー 7732
argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー Added in version 3.2. ソースコード: Lib/argparse.py 注釈 argparse は基本的なコマンドラインアプリケーションの実装に推奨される標準ライブラリのモジュールですが、動作を厳密 ... ... but that is okay''' , ... epilog = ''' ... likewise for this epilog whose whitespace will ... be cleaned up and whose words will be wrapped ... across a couple lines''' ) >>> parser . print_help () usage: PROG [-h] this description was indented w ... options: -h, --help show this help message and exit likewise for this epilog whose whitespace will be cleaned up and whose words will be wrapped across a couple lines formatter_class= に RawDescriptionHelpFormatter を渡した場合、 description と epilog ...
https://man.mtool.work/python/3.14/library/argparse.html
PREV 1 2 NEXT