0
1

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

Python > Python does not include the last offset

Last updated at Posted at 2017-01-29

@ Introducing Python: Modern Computing in Simple Packages by Bill Lubanovic
(No. 948 / 12833)

, offset 12 to 14 (Python does not include the last offset):

>>> letters[12:15]
'xyz'

ideoneで試してみた。

alphabet = 'abcdefghijklmnopqrstuvwxyz'
print(len(alphabet))

print(alphabet[0:25])
print(alphabet[:25])
print(alphabet[::-1])
結果
Success	time: 0.01 memory: 9992 signal:0
26
abcdefghijklmnopqrstuvwxy
abcdefghijklmnopqrstuvwxy
zyxwvutsrqponmlkjihgfedcba

他の言語からPythonに戻ってきた時にミスしやすいように思う。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?