書籍「Pythonチュートリアル 第3版 11.2 テンプレート」を読んで、要点を注釈付きのサンプルプログラムとしてまとめました。 なお、テンプレート(文字列)の主な使い道は国際化のようです。 「Pythonチュートリアル 第3版 11.2 テンプレート」を読んでいない人 ...
How to use the regular expression functions provided by the ‘re’ library to match, search, and replace text in your Python programs. Regular expressions, or “regex,” is a system for finding complex ...
オライリーのPythonチュートリアルを読んで知らなかったことを自分用メモとしてまとめておく。 対話モードでは、最後に表示した式を「_」に代入してある。 >>> price = 1000 >>> tax = 10 >>> price * (tax+100)/100 1100.0 >>> print(_) 1100.0 3.1.2 文字列 raw文字列:エスケープ用 ...
A regular expression (or RE) specifies a set of strings that matches it; the functions in this module let you check if a particular string matches a given regular expression (or if a given regular ...
I was involved in a recent discussion on the "best" way to remove a given parameter from a URL string. The conversation began with using string primitives to split and join the parameter, a method ...