【Python】stringモジュールの使い方

注意 stringモジュールはPython3.6.0(2016.12.23リリース)から追加された機能のため同じPython3でも古いバージョンでは対応していないことがあります。 公式のhelp 公式のhelpはこちらになります。 >>> import string >>> help(string) …...

2019.06.13 · haruka

【Python】 大文字と小文字を判定する

python3のstr型の文字列の全ての文字が大文字かどうか、小文字かどうかなどを判定させる方法を紹介する。 基本的な判定メソッド isupper() - 全て大文字かどうか判定 text1 = "HELLO" text2 = "Hello" text3 = "hello" …...

2019.05.28 · haruka

【Python】 大文字、小文字を変換する

python3のstr型の文字列の大文字小文字を入れ替えたり、大文字を小文字に変換したりする方法を紹介する。 基本的な変換メソッド upper() - 全て大文字に変換 text = "Hello World" print(text.upper()) # HELLO WORLD lower() - …...

2019.05.28 · haruka