Extract the underscore from a string. For example, prepstr("Co_py") returns (2, "Copy"). Args: s: String with underscore. Returns: Tuple of (position of underscore, string without underscore).
(s)
| 1620 | |
| 1621 | |
| 1622 | def prepstr(s): |
| 1623 | """Extract the underscore from a string. |
| 1624 | |
| 1625 | For example, prepstr("Co_py") returns (2, "Copy"). |
| 1626 | |
| 1627 | Args: |
| 1628 | s: String with underscore. |
| 1629 | |
| 1630 | Returns: |
| 1631 | Tuple of (position of underscore, string without underscore). |
| 1632 | """ |
| 1633 | i = s.find('_') |
| 1634 | if i >= 0: |
| 1635 | s = s[:i] + s[i+1:] |
| 1636 | return i, s |
| 1637 | |
| 1638 | |
| 1639 | keynames = { |
no test coverage detected
searching dependent graphs…