エントリーの編集

エントリーの編集は全ユーザーに共通の機能です。
必ずガイドラインを一読の上ご利用ください。

- バナー広告なし
- ミュート機能あり
- ダークモード搭載
関連記事
Python: 現在の日付・時刻の取得と出力 – datetimeクラスの属性、today()、strftime()メソッド
ソースコード #!/usr/bin/python # coding: UTF-8 # 現在の日付・時刻の取得と出力 | datetimeクラスの... ソースコード #!/usr/bin/python # coding: UTF-8 # 現在の日付・時刻の取得と出力 | datetimeクラスの属性、today()、strftime()メソッドの使い方 import datetime # datetimeモジュールのインポート import locale # import文はどこに書いてもOK(可読性などの為、慣例でコードの始めの方) # today()メソッドで現在日付・時刻のdatetime型データの変数を取得 d = datetime.datetime.today() # ↑モジュール名.クラス名.メソッド名 print 'd == %s : %s\n' % (d, type(d)) # Microsecond(10^-6sec)まで取得 # datetime型の各属性へのアクセス # year, month, day print
2016/03/14 リンク