For each element in `a`, return a list of the words in the string, using `sep` as the delimiter string. Calls `str.rsplit` element-wise. Except for splitting from the right, `rsplit` behaves like `split`. Parameters ---------- a : array_like of str or unicode
(a, sep=None, maxsplit=None)
| 1420 | |
| 1421 | @array_function_dispatch(_split_dispatcher) |
| 1422 | def rsplit(a, sep=None, maxsplit=None): |
| 1423 | """ |
| 1424 | For each element in `a`, return a list of the words in the |
| 1425 | string, using `sep` as the delimiter string. |
| 1426 | |
| 1427 | Calls `str.rsplit` element-wise. |
| 1428 | |
| 1429 | Except for splitting from the right, `rsplit` |
| 1430 | behaves like `split`. |
| 1431 | |
| 1432 | Parameters |
| 1433 | ---------- |
| 1434 | a : array_like of str or unicode |
| 1435 | |
| 1436 | sep : str or unicode, optional |
| 1437 | If `sep` is not specified or None, any whitespace string |
| 1438 | is a separator. |
| 1439 | maxsplit : int, optional |
| 1440 | If `maxsplit` is given, at most `maxsplit` splits are done, |
| 1441 | the rightmost ones. |
| 1442 | |
| 1443 | Returns |
| 1444 | ------- |
| 1445 | out : ndarray |
| 1446 | Array of list objects |
| 1447 | |
| 1448 | See Also |
| 1449 | -------- |
| 1450 | str.rsplit, split |
| 1451 | |
| 1452 | """ |
| 1453 | # This will return an array of lists of different sizes, so we |
| 1454 | # leave it as an object array |
| 1455 | return _vec_string( |
| 1456 | a, object_, 'rsplit', [sep] + _clean_args(maxsplit)) |
| 1457 | |
| 1458 | |
| 1459 | def _strip_dispatcher(a, chars=None): |
no test coverage detected