Module src.Strings
This file will store all the functions about managing strings
It can be imported via:
from PythonQuickStartModule.src import Strings
Expand source code
""" This file will store all the functions about managing strings
It can be imported via:
from PythonQuickStartModule.src import Strings
"""
import sys
from PythonQuickStartModule.src import Lists
def RemoveNewLine(string):
"""This function will remove the \n from a string
Args:
string (str): The string you want the \n removed from
Returns:
str: The string you passed in without the \n
"""
try:
stringList = list(string)
except TypeError:
sys.exit("The vairiable: {} is not a str".format(string))
try:
stringList.remove("\n")
except:
return string
return Lists.ListToStr(stringList)
Functions
def RemoveNewLine(string)
-
This function will remove the from a string
Args: string (str): The string you want the removed from
Returns: str: The string you passed in without the
Expand source code
def RemoveNewLine(string): """This function will remove the \n from a string Args: string (str): The string you want the \n removed from Returns: str: The string you passed in without the \n """ try: stringList = list(string) except TypeError: sys.exit("The vairiable: {} is not a str".format(string)) try: stringList.remove("\n") except: return string return Lists.ListToStr(stringList)