1
1

【Python 型ヒントTips】for文で型ヒントを使う方法

Last updated at Posted at 2024-04-29

はじめに

Pythonのfor文で型ヒントを使う方法のメモ。

動作確認環境

  • Python 3.8.10

方法

ループの前で変数を宣言する。

i: int
for i in range(5):
    pass

参考

1
1
1

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
1
1