LoginSignup
0
1

More than 3 years have passed since last update.

【初心者】Pythonの配列

Last updated at Posted at 2020-07-03

Pythonで配列を使ってみる

split()に何も指定しないと、空白で区切ってリストを作ってくれる。


>>> s1 = "The quick brown fox jumps over the lazy dog."
>>> s_list = s1.split()
>>> print(s_list)
['The', 'quick', 'brown', 'fox', 'jumps', 'over', 'the', 'lazy', 'dog.']
>>> print(s_list[1])
quick
>>> len(s_list)
9
>>> while i < len(s_list):
    print(s_list[i])
    i += 1


The
quick
brown
fox
jumps
over
the
lazy
dog

>>> for w in s_list:
    print(w)


The
quick
brown
fox
jumps
over
the
lazy
dog.
0
1
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
0
1