[Tutor] trying to split or rpartition the contents of a list

Amit Saha amitsaha.in at gmail.com
Thu May 23 15:00:22 CEST 2013


Hi Stuart,

On Thu, May 23, 2013 at 10:57 PM, Stuart Tozer <stutozer at gmail.com> wrote:
> Hello Amit- your solution works very well. Thanks very much!

Good to know that! Hope it was clear.

All the best.
-Amit

>
> Best regards,
> Stu
>
>
> On Wed, May 22, 2013 at 11:39 AM, Stuart Tozer <stutozer at gmail.com> wrote:
>>
>> Thanks very much guys- I'll get back to this when I have a spare moment
>> and let you know how I get on.
>>
>> Cheers,
>> Stu
>>
>>
>>
>> On Wed, May 22, 2013 at 11:06 AM, Albert-Jan Roskam <fomcl at yahoo.com>
>> wrote:
>>>
>>> >
>>>
>>>
>>> > >forobjectinobjects:sorted(set(object.split('_',1)[0]))cmds.menuItem(label
>>> > =object,parent ="objectMenu")
>>>
>>>
>>> "sorted" returns the sorted list but you don't assign anything to it. You
>>> can either assign it to a variable, or use the .sort method instead. Also,
>>> you don't need to specify the maxsplit argument (1) in .split. Also, you
>>> used 'object' as a loop index but this is a reserved word. Why not use the
>>> more descriptive "for filename in filenames"?
>>
>>
>>
>>
>> --
>> http://stutozer.elementfx.com/
>>
>>
>
>
>
> --
> http://stutozer.elementfx.com/
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



--
http://echorand.me


More information about the Tutor mailing list