Journal smittyoneeach's Journal: Leveling up with python 2
$ py
Python 3.4.3 (default, Jun 14 2015, 02:11:57) [MSC v.1800 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> dat="http://docs.aws.amazon.com/IAM/latest/UserGuide/Using_ManagingMFA.html"
>>> print(dat.split("/"))
['http:', '', 'docs.aws.amazon.com', 'IAM', 'latest', 'UserGuide', 'Using_ManagingMFA.html']
>>> print(dat.split("/")[1:])
['', 'docs.aws.amazon.com', 'IAM', 'latest', 'UserGuide', 'Using_ManagingMFA.html']
>>> print(dat.split("/")[2:])
['docs.aws.amazon.com', 'IAM', 'latest', 'UserGuide', 'Using_ManagingMFA.html']
>>> print(dat.split("/")[3:])
['IAM', 'latest', 'UserGuide', 'Using_ManagingMFA.html']
>>> print(dat.split("/")[3:-1])
['IAM', 'latest', 'UserGuide']
I hadn't ever used the python REPL to work on a bit of code, but it sure makes exploring the slicing notation easier.
Damn, man! (Score:1)
Always with the amazon... :-)
Re: (Score:1)