![]() |
|
|
+ Search |
![]()
|
Nov 11th, 2003 14:21
Jim Vanderveen, Sam G,
One way to do this is with slices. >>> s = '1234567' >>> print s 1234567 >>> # Strip off the rightmost 2 chars >>> s = s[:-2] >>> print s 12345 >>> # Strip off the leftmost 2 chars >>> s = s[2:] >>> print s 345