Replace spaces in a string with hyphens. Parameters ---------- text : str Input string. Returns ------- str String with spaces replaced by '-'.
(text: str)
| 12 | |
| 13 | |
| 14 | def replacetext(text: str) -> str: |
| 15 | """ |
| 16 | Replace spaces in a string with hyphens. |
| 17 | |
| 18 | Parameters |
| 19 | ---------- |
| 20 | text : str |
| 21 | Input string. |
| 22 | |
| 23 | Returns |
| 24 | ------- |
| 25 | str |
| 26 | String with spaces replaced by '-'. |
| 27 | """ |
| 28 | return text.replace(" ", "-") |
| 29 | |
| 30 | |
| 31 | if __name__ == "__main__": |