0% found this document useful (0 votes)
28 views23 pages

UNIT - 3 - Python - String, List, Tuple, Set, Dict Manipulation Functions

The document provides an overview of various built-in functions in Python for manipulating strings, lists, tuples, and dictionaries. It details specific methods for lists such as append(), clear(), and insert(), as well as string functions like lower(), upper(), count(), and split(). Additionally, it explains the usage of the join() function for combining strings.

Uploaded by

Hemangini Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views23 pages

UNIT - 3 - Python - String, List, Tuple, Set, Dict Manipulation Functions

The document provides an overview of various built-in functions in Python for manipulating strings, lists, tuples, and dictionaries. It details specific methods for lists such as append(), clear(), and insert(), as well as string functions like lower(), upper(), count(), and split(). Additionally, it explains the usage of the join() function for combining strings.

Uploaded by

Hemangini Patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 23

PYTHON – STRING,

LIST ,TUPLE, DICT


MANIPULATION
Module
FUNCTION
LIST
FUNCTIONS
 Python has a set of built-in methods that
you can use on lists
LIST
FUNCTIONS
 Python has a set of built-in methods that
you can use on lists
LIST
FUNCTIONS
 Python List append()
Method

The append() method appends an


element to the end of the list.
LIST
FUNCTIONS
 Python List append()
Method
LIST
FUNCTIONS
 Python List clear()
Method

 It is used to clear/empty
the list.
LIST
FUNCTIONS
 Python List clear()
Method

The clear() method removes


all
the elements from list.
LIST
FUNCTIONS
 Python List insert() Method
 The insert() method inserts the specified
value at the specified position.
STRING
FUNCTIONS
 lower(): Converts all uppercase
characters in a string into lowercase
 upper(): Converts all lowercase
characters in a string into uppercase
 title(): Convert string to title case
 swapcase(): Swap the cases of all
characters in a string
 capitalize(): Convert the first character of
a string to uppercase
STRING
FUNCTIONS
 Example: Changing the case of Python
Strings
STRING
FUNCTIONS
 Example: Changing the case of Python
Strings
STRING
FUNCTIONS
 Example: Changing the case of Python
Strings
 O/P:
STRING
FUNCTIONS
 Python String count() Method
 Python String count() function returns the
number of occurrences of a substring
within a String.
STRING
FUNCTIONS
 Python String count()
Method
 O/P:
STRING
FUNCTIONS
 Python String isalnum() Method
 Python String isalnum() method checks
whether all the characters in a given string
are either alphabet or numeric
(alphanumeric) characters.
 Syntax: string_name.isalnum()
 True: If all the characters are alphanumeric
 False: If one or more characters
are not alphanumeric
STRING
FUNCTIONS
STRING
FUNCTIONS
 String isalpha() in Python
Example
STRING
FUNCTIONS
 Python String lstrip() method
 Python String lstrip() method returns a
copy of the string with leading characters
removed (based on the string argument
passed).

If no argument is passed, it
removes leading spaces.
STRING
FUNCTIONS
STRING
FUNCTIONS
 Split a String
 It is a very common practice to split a
string into smaller strings. In Python, we
use the split() function to do this. It splits
the string from the identified separator
and returns all the pieces in a list.
 Syntax:
 string.split(separator, maxsplit)
 separator: the string splits at this separator.
 maxsplit (optional): tells how many splits to do.
STRING
FUNCTIONS
STRING
FUNCTIONS
 join() Function
 This method is used to join a sequence of
strings with some operator. The join()
operator will create a new string by
joining every character of the sequence
with a specified character, including
whitespaces.
STRING
FUNCTIONS

You might also like