October 21, 2020 at 12:00 am
Comments posted to this topic are about the item Slicing a String in Python
October 21, 2020 at 7:06 am
I have never used Python, but this seems to be a nice feature.
/Håkan Winther
MCITP:Database Developer 2008
MCTS: SQL Server 2008, Implementation and Maintenance
MCSE: Data Platform
October 21, 2020 at 5:05 pm
Question: wouldn't "ssn[7:11]" and "ssn[7:]" give "-1234" (including the hyphen)?
October 22, 2020 at 6:24 am
Python is 0 based so ssn[7] is '4'. ssn[7:] is '4567'
October 22, 2020 at 12:17 pm
Thank you, I understand now. That would make the other viable option ssn[7:10], correct?
October 22, 2020 at 5:40 pm
ssn[7:10] gives you '456'
Viewing 6 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy