New submission from Aleksandr Sigalov <tegridyc...@gmail.com>:

The following code ran in Google Colab...

=====================================

import sys

print (sys.version)

string = 'WORD=BIRD\nBIRD\nBIRD'

print(string.split())

print('========')

print(string.split('=')[0][0:3])
print(string.split('=')[1][0:3])

=================================

produces this...

=================================

3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0]
['WORD=BIRD', 'BIRD', 'BIRD']
========
WOR
BIR

=================================

Shouldn't index [0:3] give 4 chars? I looked in the docs and I could not find 
anything explaining this behavior.

=================================

Thanks.

----------
components: Build
messages: 385975
nosy: tegridycode
priority: normal
severity: normal
status: open
title: str.split() indexing issue
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43076>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to