[2,3,4,7] --> "2-4,7" ?

Bengt Richter bokr at oz.net
Fri May 30 20:27:48 EDT 2003


On Thu, 29 May 2003 15:11:21 -0400, George Young <gry at ll.mit.edu> wrote:

>[python 2.3a1]
>I have a list of "names" like:
>  ['6','7','mx8','mx09','mx10','8','9','10','foo']
>which needs for concise and clear display to become a string like:
>
>  "6-7,mx8-10,8-10,foo"

Don't you need to be able to reconstitute the original sequence from the
abbreviated one? I.e., how would you know to go backwards to 'mx09' vs 'mx9' ?

[...]

Regards,
Bengt Richter




More information about the Python-list mailing list