Split and Join Methods



Python has the following methods to perform split and join operations −

Sr.No. Method & Description

1

lstrip()

Removes all leading whitespace in string.

2

rstrip()

Removes all trailing whitespace of string.

3

strip()

Performs both lstrip() and rstrip() on string

4

rsplit()

Splits the string from the end and returns a list of substrings

5

split()

Splits string according to delimiter (space if not provided) and returns list of substrings.

6

splitlines()

Splits string at NEWLINEs and returns a list of each line with NEWLINEs removed.

7

partition()

Splits the string in three string tuple at the first occurrence of separator

8

rpartition()

Splits the string in three string tuple at the ladt occurrence of separator

9

join()

Concatenates the string representations of elements in sequence into a string, with separator string.

10

removeprefix()

Returns a string after removing the prefix string

11

removesuffix()

Returns a string after removing the suffix string

python_string_methods.htm
Advertisements
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy