per page, with , order by , clip by
Results of 1 - 10 of about 101 for Argument (0.006 sec.)
argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー 16240
argparse --- コマンドラインオプションや引数、サブコマンド向けのパーサー Added in version 3.2. ソースコード: Lib/argparse.py 注釈 argparse は基本的なコマンドラインアプリケーションの実装に推奨される標準ライブラリのモジュールですが、動作を厳密 ... 動生成し、ユーザーが不正な引数を渡すとエラーを表示します。 argparse のコマンドラインインターフェースのサポートは、 argparse.ArgumentParser のインスタンスを中心に構成されています。 このオブジェクトは引数の仕様を格納し、パーサー全体に適用するオプションを持ち ... ます。 parser = argparse . ArgumentParser ( prog = 'ProgramName' , description = 'What the program does' , epilog = 'Text at the bottom of help' ) ArgumentPar ... ser.add_argument() メソッドは各引数の仕様をパーサーに付属させます。このメソッドは位置引数、値を受け取るオプション、機能のオン/オフを切り替え ...
https://man.mtool.work/python/3.14/library/argparse.html
Argparse チュートリアル 13451
Argparse チュートリアル author : Tshepang Mbambo このチュートリアルでは、 argparse を丁寧に説明します。 argparse は、Python 標準ライブラリの一部であり、おすすめのコマンドライン引数の解析モジュールです。 注釈 標準ライブラリには、コマンドライ ... うに動作するかわかります。 基礎 (ほとんど)何もしない、とても簡単な例から始めましょう: import argparse parser = argparse . ArgumentParser () parser . parse_args () 下記がこのコードを実行した結果です: $ python prog.py $ python prog.py --help usage: prog.p ... ns: -h, --help show this help message and exit $ python prog.py --verbose usage: prog.py [-h] prog.py: error: unrecognized arguments: --verbose $ python prog.py foo usage: prog.py [-h] prog.py: error: unrecognized arguments: foo こんなことが起こりました: ... 実装なしで役立つ使用方法のメッセージが表示されます。 位置引数の入門 以下に例を示します: import argparse parser = argparse . ArgumentParser () parser . add_argument ( "echo" ) args = parser . parse_args () print ( args . echo ) このコードを実行してみましょ ...
https://man.mtool.work/python/3.14/howto/argparse.html
sched --- イベントスケジューラー 9236
sched --- イベントスケジューラー ソースコード: Lib/sched.py sched モジュールは、汎用的なイベントスケジューラーを実装するクラスを定義しています: class sched. scheduler ( timefunc = time.monotonic , delayfunc = time.sleep ) scheduler クラスは ... rint_some_times (): ... print ( time . time ()) ... s . enter ( 10 , 1 , print_time ) ... s . enter ( 5 , 2 , print_time , argument = ( 'positional' ,)) ... # enter() は相対時刻なので、優先度の高い 'keyword' が 'positional' の後に実行される ... s . enter ... ( 5 , 1 , print_time , kwargs = { 'a' : 'keyword' }) ... s . enterabs ( 1_650_000_000 , 10 , print_time , argument = ( "first enterabs" ,)) ... s . enterabs ( 1_650_000_000 , 5 , print_time , argument = ( "second enterabs" ,)) ... s . ru ... ラオブジェクト scheduler インスタンスは以下のメソッドと属性を持っています: scheduler. enterabs ( time , priority , action , argument = () , kwargs = {} ) 新しいイベントをスケジュールします。 引数 time は、コンストラクタへ渡された timefunc の戻り値と互換な ...
https://man.mtool.work/python/3.14/library/sched.html
Argument Clinic How-To 7990
Argument Clinic How-To 注釈 Argument Clinic How-TOは、 Python Developer's Guide に移動しました。 他のマニュアルの関連ページ PHP language.types.declarations PHP zookeeper.requirements Linux JM sigqueue(3) PHP multipleiterator.construct PHP c ...
https://man.mtool.work/python/3.14/howto/clinic.html
venv --- 仮想環境の作成 7277
venv --- 仮想環境の作成 Added in version 3.3. ソースコード: Lib/venv/ venv モジュールは、軽量な「仮想環境」の作成に対応しています。 各仮想環境は、それぞれの site ディレクトリに独立した Python パッケージ群を持ちます。 仮想環境は、インストール ... led, the progress of the installation can be monitored by passing a progress callable. If specified, it is called with two arguments: a string indicating some progress, and a context indicating where the string is coming from. The context argument can ha ... /get-pip.py' self . install_script ( context , 'pip' , url ) def main ( args = None ): import argparse parser = argparse . ArgumentParser ( prog = __name__ , description = 'Creates virtual Python ' 'environments in one or ' 'more target ' 'directories.' ... ) parser . add_argument ( 'dirs' , metavar = 'ENV_DIR' , nargs = '+' , help = 'A directory in which to create the ' 'virtual environment.' ) parse ...
https://man.mtool.work/python/3.14/library/venv.html
optparse を使うコードを argparse に移行する 7225
optparse を使うコードを argparse に移行する argparse モジュールは、 optparse モジュールに標準では備わっていない、次のような高水準の機能を提供します。 位置引数を扱う サブコマンドのサポート。 + , / のような代替オプションプレフィクスを許容する ... への移行を選んだアプリケーションには、次の指針が役立つでしょう。 すべての optparse.OptionParser.add_option() の呼び出しを、 ArgumentParser.add_argument() の呼び出しに置き換える。 (options, args) = parser.parse_args() を args = parser.parse_args() に置き換 ... え、位置引数のために必要に応じて ArgumentParser.add_argument() の呼び出しを追加する。これまで options と呼ばれていたものが、 argparse では args と呼ばれていることに ... など) に置き換えてください。 optparse.Values を Namespace に置き換え、 optparse.OptionError と optparse.OptionValueError を ArgumentError に置き換える。 %default や %prog などの暗黙の引数を含む文字列を、 %(default)s や %(prog)s などの、通常の Python で辞書 ...
https://man.mtool.work/python/3.14/howto/argparse-optparse.html
email: 使用例 7225
email : 使用例 ここでは email パッケージを使って電子メールメッセージを読む・書く・送信するいくつかの例を紹介します。より複雑な MIME メッセージについても扱います。 まず、単純なテキストメッセージを作成して送信する方法を見てみましょう (テキスト ... "" import os import smtplib # ファイル名の拡張子から MIME 型を推測するために使います import mimetypes from argparse import ArgumentParser from email.message import EmailMessage from email.policy import SMTP def main (): parser = ArgumentParser ( descript ... server, which then does the normal delivery process. Your local machine must be running an SMTP server. """ ) parser . add_argument ( '-d' , '--directory' , help = """Mail the contents of the specified directory, otherwise use the current directory. Only ... the regular files in the directory are sent, and we don't recurse to subdirectories.""" ) parser . add_argument ( '-o' , '--output' , metavar = 'FILE' , help = """Print the composed message to FILE instead of sending the message to th ...
https://man.mtool.work/python/3.14/library/email.examples.html
1. Extending Python with C or C++ 7160
1. Extending Python with C or C++ It is quite easy to add new built-in modules to Python, if you know how to program in C. Such extension modules can do two things that can't be done directly in Python: they can implement new built-in objec ... te a Python interface to the C library function system() [ 1 ] . This function takes a null-terminated character string as argument and returns an integer. We want this function to be callable from Python as follows: >>> import spam >>> status = spam . s ... return NULL ; sts = system ( command ); return PyLong_FromLong ( sts ); } There is a straightforward translation from the argument list in Python (for example, the single expression "ls -l" ) to the arguments passed to the C function. The C function alw ... ays has two arguments, conventionally named self and args . The self argument points to the module object for module-level functions; for a met ...
https://man.mtool.work/python/3.14/extending/extending.html
pty --- 擬似端末ユーティリティ 6978
pty --- 擬似端末ユーティリティ ソースコード: Lib/pty.py pty モジュールは、別のプロセスを起動してその制御端末をプログラムから読み書きする、擬似端末の操作を定義します。 利用可能な環境 : Unix. 擬似端末の扱いはプラットフォームに大きく依存します ... すべての入出力を "typescript" に記録します。 import argparse import os import pty import sys import time parser = argparse . ArgumentParser () parser . add_argument ( '-a' , dest = 'append' , action = 'store_true' ) parser . add_argument ( '-p' , dest = 'u ... se_python' , action = 'store_true' ) parser . add_argument ( 'filename' , nargs = '?' , default = 'typescript' ) options = parser . parse_args () shell = sys . executable if options ...
https://man.mtool.work/python/3.14/library/pty.html
ライブラリと拡張 FAQ 6927
ライブラリと拡張 FAQ ライブラリ一般の質問 作業 X を行うためのモジュールやアプリケーションを探すにはどうしますか? ライブラリリファンレス から関係がありそうな標準ライブラリモジュールがあるかどうか調べてください。 (標準ライブラリに何があるかが ... ) print ( 'queue empty' ) break else : print ( 'Worker' , threading . current_thread (), end = ' ' ) print ( 'running with argument' , arg ) time . sleep ( 0.5 ) # キュー作成 q = queue . Queue () # 5 個のワーカーからなるプールを開始 for i in range ( 5 ): ... worker Running worker Running worker Main thread sleeping Worker <Thread(worker 1, started 130283832797456)> running with argument 0 Worker <Thread(worker 2, started 130283824404752)> running with argument 1 Worker <Thread(worker 3, started 130283816012 ... 048)> running with argument 2 Worker <Thread(worker 4, started 130283807619344)> running with argument 3 Worker <Thread(worker 5, started 130283799226 ...
https://man.mtool.work/python/3.14/faq/library.html
PREV 1 2 3 4 5 6 7 8 9 10 NEXT