explain slice assignment to newb
Andrew
aetodd at gmail.com
Sat Sep 20 17:20:20 EDT 2008
More information about the Python-list mailing list
Sat Sep 20 17:20:20 EDT 2008
- Previous message (by thread): Hi guys!
- Next message (by thread): explain slice assignment to newb
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
please explain this behavior to a newb: >>> a = [1,2,3,4] >>> b = ["a","b","c","d"] >>> a [1, 2, 3, 4] >>> b ['a', 'b', 'c', 'd'] >>> a[0:2] [1, 2] >>> a [1, 2, 3, 4] >>> b[2:4] ['c', 'd'] >>> a[0:2] = b[0:2] >>> b[2:4] = a[2:4] >>> a ['a', 'b', 3, 4] >>> b ['a', 'b', 3, 4] >>>
- Previous message (by thread): Hi guys!
- Next message (by thread): explain slice assignment to newb
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list