converting a sed / grep / awk / . . . bash pipe line into python
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Wed Sep 3 17:56:36 EDT 2008
Roy Smith:
> But, along those lines, I've often thought that split() needed a way to not
> just limit the number of splits, but to also throw away the extra stuff.
> Getting the first N fields of a string is something I've done often enough
> that refactoring the slicing operation right into the split() code seems
> worthwhile. And, it would be even faster :-)
Given the hypothetical .xsplit() string method I was talking about,
it's then easy to use islice() on it to skip the first items:
islice(sometext.xsplit(), 10, None)
Bye,
bearophile
More information about the Python-list
mailing list