5
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

自分の知らなかったPythonのより良い書き方集

Posted at

備忘録(?)としてまとめます。
あとからどんどん書き足して行こうと思います。

変数宣言/代入時の型明示

書き方

<変数名>: <組み込み型> = <値>

text: str = 'テキスト'
numbers: list = [1, "", 3.1]

こういうところで使うべし

  • メソッドの引数・返り値
  • クラスのフィールドメンバー
  • 生成したインスタンスを格納する変数

参考ソース

5
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
9

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?