Cool, thanks for those answers, it's been too long since I wrote any python
code
2008/7/4 Rory Geoghegan <[EMAIL PROTECTED]>:
>
> Cool little known kludge:
>
> to do a deep-copy of list a, simply do:
>
> a[:]
>
> On Fri, Jul 4, 2008 at 2:48 PM, Alan Kennedy <[EMAIL PROTECTED]> wrote:
> >
> > [Darragh]
> >> 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']
> >
> > Because you asked for a slice, by specifying two indices of the array,
> > e.g. args[-1:]
> >
> > If you just want a string, ask for an element
> >
> >>>> print args[-1]
> > 'test.py'
> >
> > HTH,
> >
> > Alan.
> >
> > >
> >
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---