Python/サンプル/英字の大文字・小文字を区別せず比較する方法・re
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* 英字の大文字・小文字を区別せず比較する方法・re [#i5fd24...
Pythonで英字の大文字・小文字を区別せずに比較する方法のサ...
#contents
//#htmlinsert(ll_ads_top.html)
* 関連記事 [#tb92c583]
-[[Pythonで文字列置換・replace>Python/サンプル/文字列の置...
-[[Pythonで数値を文字列に変換する・str>Python/サンプル/数...
-[[Pythonで指定した文字で分割し配列(list)に格納する方法・...
-[[Pythonで左右のスペース削除・strip, lstrip, rstrip>Pyth...
-[[Pythonでリストに格納されている要素に区切り文字を指定し...
-[[Pythonで文字列の半角英字の大文字小文字化方法・upper,lo...
-[[Pythonで文字列のleft,mid,rightを実現する方法>Python/サ...
-[[Pythonで前方・後方文字列検索・find,rfind>Python/サンプ...
-[[Pythonでカンマ区切りの文字列をリストに入れる方法・spli...
-[[Pythonでゼロパティングする方法・zfill>Python/サンプル/...
-[[Pythonで英字の大文字・小文字を区別せず比較する方法・re...
* 英字の大文字・小文字を区別しないサンプルコード [#d0b496...
lower, upper, 正規表現のreモジュールを使ったサンプルコー...
#ref(cmp.py)
import re
a = "HELLO WORLD"
b = "hello world"
if a == b:
print "same stringl\n"
if a.upper() == b.upper():
print "upper() : same string"
if a.lower() == b.lower():
print "lower() : same string"
if re.compile(a,re.IGNORECASE).match(b) != None:
print "re.cmpile... : same string"
実際に実行した時の出力です。
$ python cmp.py
upper() : same string
lower() : same string
re.cmpile... : same string
以上、Pythonで英字の大文字・小文字を区別せずに比較する方...
//#htmlinsert(ll_ads_btm.html)
終了行:
#navi(../)
* 英字の大文字・小文字を区別せず比較する方法・re [#i5fd24...
Pythonで英字の大文字・小文字を区別せずに比較する方法のサ...
#contents
//#htmlinsert(ll_ads_top.html)
* 関連記事 [#tb92c583]
-[[Pythonで文字列置換・replace>Python/サンプル/文字列の置...
-[[Pythonで数値を文字列に変換する・str>Python/サンプル/数...
-[[Pythonで指定した文字で分割し配列(list)に格納する方法・...
-[[Pythonで左右のスペース削除・strip, lstrip, rstrip>Pyth...
-[[Pythonでリストに格納されている要素に区切り文字を指定し...
-[[Pythonで文字列の半角英字の大文字小文字化方法・upper,lo...
-[[Pythonで文字列のleft,mid,rightを実現する方法>Python/サ...
-[[Pythonで前方・後方文字列検索・find,rfind>Python/サンプ...
-[[Pythonでカンマ区切りの文字列をリストに入れる方法・spli...
-[[Pythonでゼロパティングする方法・zfill>Python/サンプル/...
-[[Pythonで英字の大文字・小文字を区別せず比較する方法・re...
* 英字の大文字・小文字を区別しないサンプルコード [#d0b496...
lower, upper, 正規表現のreモジュールを使ったサンプルコー...
#ref(cmp.py)
import re
a = "HELLO WORLD"
b = "hello world"
if a == b:
print "same stringl\n"
if a.upper() == b.upper():
print "upper() : same string"
if a.lower() == b.lower():
print "lower() : same string"
if re.compile(a,re.IGNORECASE).match(b) != None:
print "re.cmpile... : same string"
実際に実行した時の出力です。
$ python cmp.py
upper() : same string
lower() : same string
re.cmpile... : same string
以上、Pythonで英字の大文字・小文字を区別せずに比較する方...
//#htmlinsert(ll_ads_btm.html)
ページ名: