LoginSignup
0
0

More than 3 years have passed since last update.

文字列のインデックスとスライス

Posted at
word = 'python'
print(word[0]) #p
print(word[1]) #y
print(word[0:2]) #py
print(word[2:5]) #tho
print(word[2:]) #thon
print(word[:2]) #py
print(word[-1]) #n
print(word[:]) #python
#word[0] = 'j' エラー出る
print(word[:]) #python
print(len(word)) #6
0
0
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
0