|
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
 |
| • |
Sequences
can be sliced
|
|
|
>>> “abcdef”[1:3]
|
|
|
“bc”
|
|
|
>>> “abcdef”[:3]
# [:n] == [0:n]
|
|
|
“abc”
|
|
|
>>> “abcdef”[3:]
# [n:] == [n:len(seq)]
|
|
“def”
|
|
|
>>> “abcdef”[:]
# copy
|
|
|
“abcdef”
|
|
|
| • |
Note,
include low, exclude high means:
|
|
|
|
• |
len(seq[n:m]) = m-n
|
|
|
|
• |
seq[:n]+seq[n:] == seq[:]
|
|
|
|