6.1.11リストをforループで処理する方法インデックス番号/値をセットで取り出す>>> data = ['ぱんだ', 'うさぎ', 'こあら', 'とら']>>>>>> for index, value in enumerate(data):... print(index, ':', value)...0 : ぱんだ1 : うさぎ2 : こあら3 : とらこのコードは以下 ...
もっと読む
タグ:REALITY挑戦中
Python勉強中 5.3.7カレンダーを生成する。 20230529
5.3.7カレンダーを生成する。>>> import calendar>>>>>> print(calendar.month(2020, 6, 5)) 6月 2020 月 火 水 木 金 土 日 1 2 3 4 5 6 7 8 ...
もっと読む
Python勉強中 5.3.6日付/時刻値を整形する 20230528
5.3.6日付/時刻値を整形する 構文 strftimeメソッドdt.strftime(format)dt :日付/時刻値(datetime/date/time)format :書式文字列import datetimeimport localelocale.setlocale(locale.LC_ALL, 'ja_JP.UTF-8')dt = datetime.datetime(2019, 12, 4, 15, 35, 58, 469)pri ...
もっと読む