Posts

Showing posts with the label most used string functions

String Functions in Python

 String Functions in Python #String Functions in Python capitalize() #Converts the first character to upper case casefold() #Converts string into lower case center() #Returns a centered string count() #Returns the number of times a specified value occurs in a string encode() #Returns an encoded version of the string endswith() #Returns true if the string ends with the specified value expandtabs() #Sets the tab size of the string find() #Searches the string for a specified value and returns the position of where it was found format () #Formats specified values in a string format_map() #Formats specified values in a string index() #Searches the string for a specified value and returns the position of where it was found isalnum() #Returns True if all characters in the string are alphanumeric isalpha() #Returns True if all characters in the string are in the alphabet isdecimal() #Returns True if all characters in the string are decimals isdigit() #Returns True if...

Python Tutorial 4---"String Slicing And Other Functions In Python"

Image
  Python Tutorial 4--- "String Slicing And Other Functions In Python" This PROGRAM or TUTORIAL about Python's  " String Slicing And Other Functions In Python " DOC String is a data type in Python.  Strings in Python programming language  are arrays of bytes representing a sequence of characters. In simple terms, Strings are the combination or collection of characters enclosed in quotes. Primarily, you will find 3 types of strings in Python : Single Quote String – (‘Single Quote String’) Double Quote String – (“Double Quote String”) Triple Quote String – (‘’’ Triple Quote String ‘’’) Let us now look into some functions you will use to manipulate or perform operations on strings. len() Function :  This len() function returns the total no. of characters in a string.  E.g. for string a="abc", len(a) will return 3 as the output as it is a string variable containing 3 characters Strings are one of the most used data types in any programming language because ...