On 2014-11-11 06:19, eryksun wrote:
On Tue, Nov 11, 2014 at 4:52 AM, Alan Gauld <[email protected]>
wrote:
Python 3 extended unpacking:
>>> a, *bcd, e = 'abcde'
>>> a
'a'
>>> bcd
['b', 'c', 'd']
>>> e
'e'
Seeing the above in a recent post, it made me wonder what would happen
if the string had only two characters. All went well and I'm wondering
if I've stumbled across a solution to a problem I don't yet know
about:-)
b, *m, e = 'abcdefghi' # Length can be even or odd.
while m:
print(b, m, e, sep='/')
b, *m, e = m
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor