Last active
July 31, 2021 18:11
-
-
Save techykajal/3ed44f79238804aa0406b67934fdc87f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def remove_newlines_tabs(text): | |
| """ | |
| This function will remove all the occurrences of newlines, tabs, and combinations like: \\n, \\. | |
| arguments: | |
| input_text: "text" of type "String". | |
| return: | |
| value: "text" after removal of newlines, tabs, \\n, \\ characters. | |
| Example: | |
| Input : This is her \\ first day at this place.\n Please,\t Be nice to her.\\n | |
| Output : This is her first day at this place. Please, Be nice to her. | |
| """ | |
| # Replacing all the occurrences of \n,\\n,\t,\\ with a space. | |
| Formatted_text = text.replace('\\n', ' ').replace('\n', ' ').replace('\t',' ').replace('\\', ' ').replace('. com', '.com') | |
| return Formatted_text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment