Because you requested one ;) If you did
>>> print args[-1]
you would get
'test.py'
The presence of a ':' in args[-1:] means you are requesting a sequence,
even if it contains a single item.
-Padraig
Darragh Sherwin wrote:
> Why does python return a list rather than a string in this case?
>
> >>> mystr = "./test.py"
> >>> print mystr.split('/')
> ['.', 'test.py']
> >>> args = mystr.split('/')
> >>> print args[-1:]
> ['test.py']
> >>>
>
> Thanks
> Darragh
>
> >
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Python Ireland" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.ie/group/pythonireland?hl=en
-~----------~----~----~----~------~----~------~--~---