Python has several built-in functions associated with the string data type. These functions let us easily modify and manipulate strings. Creating Strings is the simplest and easy to use in Python. To create a string in Python, we simply enclose a text in single as well as double-quotes.
# String And String Function s = "tutor Joes" print(s) print(type(s)) print(s.upper()) print(s.lower()) print(s.capitalize()) print(s.title()) print(s.count("t")) print(s.endswith("ED")) print(s.find("o")) print(s.find("o", 5)) print(s.replace("o", '0')) a = "joes1234" print("Is Upper : ", a.isupper()) print("Is Lower : ", a.islower()) print("Is Alpha Numeric : ", a.isalnum()) print("Is Alpha : ", a.isalpha()) s = "he\nis\ngood" print(s) print(s.splitlines()) print(s.splitlines(True)) a = "Tutor Joes Computer Education" print(a.split(" ")) a = "Tutor,Joes,Computer,Education" print(a.split(",")) s=" Joes " print(len(s)) print(len(s.strip())) print(len(s.lstrip())) print(len(s.rstrip())) s='12-03-2020' print(s.partition('-'))To download raw file Click Here
tutor JoesTUTOR JOES tutor joes Tutor joes Tutor Joes 2 False 3 7 tut0r J0es Is Upper : False Is Lower : True Is Alpha Numeric : True Is Alpha : False he is good ['he', 'is', 'good'] ['he\n', 'is\n', 'good'] ['Tutor', 'Joes', 'Computer', 'Education'] ['Tutor', 'Joes', 'Computer', 'Education'] 13 4 9 8 ('12', '-', '03-2020')
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions