per page, with , order by , clip by
Results of 1 - 10 of about 64 for Hello (0.008 sec.)
tokenize --- Python ソース用のトークナイザー 12894
tokenize --- Python ソース用のトークナイザー ソースコード: Lib/tokenize.py The tokenize module provides a lexical scanner for Python source code, implemented in Python. The scanner in this module returns comments as tokens as well, making i ... okval )) return untokenize ( result ) . decode ( 'utf-8' ) コマンドラインからトークナイズする例。次のスクリプトが: def say_hello (): print ( "Hello, World!" ) say_hello () will be tokenized to the following output where the first column is the range o ... , the second column is the name of the token, and the final column is the value of the token (if any) $ python -m tokenize hello.py 0,0-0,0: ENCODING 'utf-8' 1,0-1,3: NAME 'def' 1,4-1,13: NAME 'say_hello' 1,13-1,14: OP '(' 1,14-1,15: OP ')' 1,15-1,16: ... OP ':' 1,16-1,17: NEWLINE '\n' 2,0-2,4: INDENT ' ' 2,4-2,9: NAME 'print' 2,9-2,10: OP '(' 2,10-2,25: STRING '"Hello, World!"' 2,25-2,26: OP ')' 2,26-2,27: NEWLINE '\n' 3,0-3,1: NL '\n' 4,0-4,0: DEDENT '' 4,0-4,9: NAME 'say_hello' 4,9-4,10 ...
https://man.mtool.work/python/3.14/library/tokenize.html
textwrap --- テキストの折り返しと詰め込み 12520
textwrap --- テキストの折り返しと詰め込み ソースコード: Lib/textwrap.py textwrap モジュールは、実際の処理をすべて担う TextWrapper クラスと、いくつかの便利な関数を提供します。 1 つか 2 つの文字列を折り返したり詰め込んだりするだけなら、これら ... 場合、残りの文字数と placeholder との和が width 内に収まるように、末尾から単語が切り捨てられます: >>> textwrap . shorten ( "Hello world!" , width = 12 ) 'Hello world!' >>> textwrap . shorten ( "Hello world!" , width = 11 ) 'Hello [...]' >>> textwrap . ... shorten ( "Hello world" , width = 10 , placeholder = "..." ) 'Hello...' オプションのキーワード引数は、以下で説明する TextWrapper インスタン ... ようにするために使われます。 タブとスペースはともにホワイトスペースとして扱われますが、同じではないことに注意してください: " hello" という行と "\thello" は、同じ先頭の空白文字をもっていないとみなされます。 空白文字しか含まない行は入力の際に無視され、出力 ...
https://man.mtool.work/python/3.14/library/textwrap.html
multiprocessing --- プロセスベースの並列処理 9735
multiprocessing --- プロセスベースの並列処理 ソースコード: Lib/multiprocessing/ 利用可能な環境 : not Android, not iOS, not WASI. このモジュールは モバイルプラットフォーム と WebAssemblyプラットフォーム をサポートしません。 はじめに multipro ... います。 以下は、複数のプロセスを使うプログラムの簡単な例です。 from multiprocessing import Process def f ( name ): print ( 'hello' , name ) if __name__ == '__main__' : p = Process ( target = f , args = ( 'bob' ,)) p . start () p . join () 実行された個々 ... parent process:' , os . getppid ()) print ( 'process id:' , os . getpid ()) def f ( name ): info ( 'function f' ) print ( 'hello' , name ) if __name__ == '__main__' : info ( 'main line' ) p = Process ( target = f , args = ( 'bob' ,)) p . start () p . ... 内で、関数 set_start_method() によって指定します。以下に例を示します: import multiprocessing as mp def foo ( q ): q . put ( 'hello' ) if __name__ == '__main__' : mp . set_start_method ( 'spawn' ) q = mp . Queue () p = mp . Process ( target = foo , args ...
https://man.mtool.work/python/3.14/library/multiprocessing.html
asyncio --- 非同期 I/O 9232
asyncio --- 非同期 I/O Hello World! import asyncio async def main (): print ( 'Hello ...' ) await asyncio . sleep ( 1 ) print ( '... World!' ) asyncio . run ( main ()) asyncio は async/await 構文を使い 並行処理の コードを書くためのライブラリ ... ", "copyright", "credits" or "license" for more information. >>> import asyncio >>> await asyncio . sleep ( 10 , result = 'hello' ) 'hello' この REPL と PYTHON_BASIC_REPL の互換性は限定的です。 すべての機能と最新の機能を使うには、デフォルトの REPL を推 ...
https://man.mtool.work/python/3.14/library/asyncio.html
socketserver --- ネットワークサーバーのフレームワーク 9232
socketserver --- ネットワークサーバーのフレームワーク ソースコード: Lib/socketserver.py socketserver モジュールを使うと、ネットワークサーバを簡単に作成できます。 利用可能な環境 : not WASI. このモジュールは WebAssembly では動作しないか、利用 ... ta ) print ( "Received:" , received ) この例の出力は次のようになります: サーバー: $ python TCPServer.py 127.0.0.1 wrote: b'hello world with TCP' 127.0.0.1 wrote: b'python is nice' クライアント: $ python TCPClient.py hello world with TCP Sent: hello wo ... rld with TCP Received: HELLO WORLD WITH TCP $ python TCPClient.py python is nice Sent: python is nice Received: PYTHON IS NICE socketserver.UDPServer の ... on = True server_thread . start () print ( "Server loop running in thread:" , server_thread . name ) client ( ip , port , "Hello World 1" ) client ( ip , port , "Hello World 2" ) client ( ip , port , "Hello World 3" ) server . shutdown () この例の出力 ...
https://man.mtool.work/python/3.14/library/socketserver.html
Logging クックブック 9103
Logging クックブック Author : Vinay Sajip <vinay_sajip at red-dove dot com> このページは、過去に有用であるとされていた、logging に関連するいくつものレシピを含んでいます。チュートリアルやリファレンス情報へのリンクについては その他のリソース ... thread = threading . Thread ( target = worker , args = ( info ,)) thread . start () while True : try : logging . debug ( 'Hello from main' ) time . sleep ( 0.75 ) except KeyboardInterrupt : info [ 'stop' ] = True break thread . join () if __name__ == ... '__main__' : main () 実行すると、出力は以下のようになるはずです: 0 Thread-1 Hi from myfunc 3 MainThread Hello from main 505 Thread-1 Hi from myfunc 755 MainThread Hello from main 1007 Thread-1 Hi from myfunc 1507 MainThread Hello fr ... om main 1508 Thread-1 Hi from myfunc 2010 Thread-1 Hi from myfunc 2258 MainThread Hello from main 2512 Thread-1 Hi from myfunc 3009 MainThread Hello from main 3013 Thread-1 Hi from myfunc 3515 Thread-1 Hi from ...
https://man.mtool.work/python/3.14/howto/logging-cookbook.html
mmap --- メモリマップファイルのサポート 9103
mmap --- メモリマップファイルのサポート 利用可能な環境 : not WASI. このモジュールは WebAssembly では動作しないか、利用不可です。詳しくは、 WebAssembly プラットフォーム を見てください。 Memory-mapped file objects behave like both bytearray a ... タが追加されました。 この例は mmap の簡潔な使い方を示すものです: import mmap # 簡単なサンプルファイルを書き込む with open ( "hello.txt" , "wb" ) as f : f . write ( b "Hello Python! \n " ) with open ( "hello.txt" , "r+b" ) as f : # ファイルをメモリにマッ ... 表す mm = mmap . mmap ( f . fileno (), 0 ) # 標準のファイルメソッドで内容を読む print ( mm . readline ()) # 表示する内容: b"Hello Python!\n" # スライス表記で内容を読む print ( mm [: 5 ]) # 表示する内容: b"Hello" # スライス表記で内容を更新する。 # 新しい ... ] = b " world! \n " # ... 標準のファイルメソッドでもう一度読む mm . seek ( 0 ) print ( mm . readline ()) # 表示する内容: b"Hello world!\n" # マップを閉じる mm . close () mmap は with 文の中でコンテキストマネージャとしても使えます: import mmap with mma ...
https://man.mtool.work/python/3.14/library/mmap.html
ctypes --- Python 用の外部関数ライブラリ 8859
ctypes --- Python 用の外部関数ライブラリ ソースコード: Lib/ctypes ctypes は Python 用の外部関数ライブラリです。 C と互換性のあるデータ型を提供し、DLL や共有ライブラリの関数を呼び出せます。 これらのライブラリを純粋な Python でラップするために ... よって作成でき、オプションとして型と値が合っている初期化子を指定することができます: >>> c_int () c_long(0) >>> c_wchar_p ( "Hello, World" ) c_wchar_p(140018365411392) >>> c_ushort ( - 3 ) c_ushort(65533) >>> 数値型のコンストラクタは、 __bool__() 、 __i ... モリ位置 が変わり、メモリブロックの 内容は変わりません (Python の文字列オブジェクトは不変なので、当然の動作です)。 >>> s = "Hello, World" >>> c_s = c_wchar_p ( s ) >>> print ( c_s ) c_wchar_p(139966785747344) >>> print ( c_s . value ) Hello World >>> c ... ion has changed c_wchar_p(139966783348904) >>> print ( c_s . value ) Hi, there >>> print ( s ) # first object is unchanged Hello, World >>> しかし、変更可能なメモリを指すポインタであることを想定している関数へそれらを渡さないように注意すべきです。もし変 ...
https://man.mtool.work/python/3.14/library/ctypes.html
Windows 上の Python FAQ 8471
Windows 上の Python FAQ Python プログラムを Windows で動かすにはどうしますか? これは必ずしも単純な質問ではありません。Windows コマンドラインからプログラムを実行するのに慣れてしまっている場合は、全て明らかなことに思えるでしょう; そうでない場 ... とができます。これが Python の最強の機能のひとつです。いくつかの式を選んで入力し、結果を見て確かめてみましょう: >>> print ( "Hello" ) Hello >>> "Hello" * 3 'HelloHelloHello' 多くの人が対話モードを便利で高度なプログラム可能計算機として使っています。対話式 ... 。 そのためには Python スクリプトの絶対パスあるいは相対パスを与える必要があります。 Python スクリプトがデスクトップにあり、 hello.py という名前で、ちょうど良いことにコマンドプロンプトがホームディレクトリを開いていると仮定しましょう。 そうすると次のよう ... にスクリプトのパスを入力することで、 Python にスクリプトを渡すよう py コマンドに命令できます: C:\Users\YourName> py Desktop\hello.py hello Python スクリプトを実行可能にするにはどうしますか? Windows では、標準の Python インストーラはすでに .py 拡張子をあ ...
https://man.mtool.work/python/3.14/faq/windows.html
functools --- 高階関数と呼び出し可能オブジェクトの操作 8471
functools --- 高階関数と呼び出し可能オブジェクトの操作 ソースコード: Lib/functools.py functools モジュールは、ほかの関数を操作したり返したりする高階関数のためのモジュールです。 一般に、このモジュールではあらゆる呼び出し可能オブジェクトを関数 ... べてを埋める必要があります。 >>> say_to_world = partial ( print , Placeholder , Placeholder , "world!" ) >>> say_to_world ( 'Hello' , 'dear' ) Hello dear world! say_to_world('Hello') を呼び出すと TypeError を送出します。 埋めるべきプレースホルダーが 2 つ ... す。 >>> from functools import partial , Placeholder as _ >>> remove = partial ( str . replace , _ , _ , '' ) >>> message = 'Hello, dear dear world!' >>> remove ( message , ' dear' ) 'Hello, world!' >>> remove_dear = partial ( remove , _ , ' dear' ) >>> ... remove_dear ( message ) 'Hello, world!' >>> remove_first_dear = partial ( remove_dear , _ , 1 ) >>> remove_first_dear ( message ) 'Hello, dear world!' Pl ...
https://man.mtool.work/python/3.14/library/functools.html
PREV 1 2 3 4 5 6 7 NEXT