4
4

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 3 years have passed since last update.

Python学習中に出会った記法

Posted at

Python学習中に出会った見知らぬ記法たち

配列の中にコロン [スライス]

hairetu = ["a","b","c","d","e"]

という配列がある状態で、

hairetu[1:3]

と指定すると、

"b","c","d" と帰ってくる。

また

hairetu[:2]とすると
"a","b","c" と帰ってくる。

コロンはコロン前のインデックスからコロン後のインデックスまでの配列を切り出せる。

Pythonではスライスと呼ぶらしい。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?