"\ no parking lstrip() rstrip() strip(('no parking ''\ no parking''no parking'"strip("[](){}"'unbracketedwe can also replace strings within strings using the str replace(method this method takes two string argumentsand returns copy of the string it is called on with every occurrence of the first string replaced with the second if the second argument is an empty string the effect is to delete every occurrence of the first string we will see examples of str replace(and some other string methods in the csv html py example in the examples section toward the end of the one frequent requirement is to split string into list of strings for examplewe might have text file of data with one record per line and each record' fields separated by asterisks this can be done using the str split(method and passing in the string to split on as its first argumentand optionally the maximum number of splits to make as the second argument if we don' specify the second argumentas many splits are made as possible here is an examplerecord "leo tolstoy**fields record split("*"fields ['leo tolstoy'''''now we can use str split(again on the date of birth and date of death to calculate how long he lived (give or take year)born fields[ split("-"born [' '' '' 'died fields[ split("-"print("lived about"int(died[ ]int(born[ ])"years"lived about years we had to use int(to convert the years from strings to integersbut other than that the snippet is straightforward we could have gotten the years directly from the fields listfor exampleyear_born int(fields[ split("-")[ ]the two methods that we did not summarize in tables and are str maketrans(and str translate(the str maketrans(method is used to create translation table which maps characters to characters it accepts onetwoor three argumentsbut we will show only the simplest (two argumentcall where the first argument is string containing characters to translate from and the second argument is string containing the characters to translate to csv html py example