Delimiters in Python with Example

A delimiter in Python is a sequence of one or more characters that specifies the boundary between various sections in plain text or other data streams.

Python uses symbols and combinations of symbols as delimiters in expressions, literals, tuples, lists, dictionaries, strings, and various parts of a statement.

These delimiters (i.e. symbols) perform three special roles in Python, such as grouping, punctuation, assignment/binding of objects to names.

For example, the equal ( = ) character or symbol acts as a delimiter between the name and value of an assignment.

Another example of delimiter is comma (,) character that we used to delimit arguments to a function, elements in a list, and so on.

List of Delimiters in Python Language


A below table shows a list of delimiters with their classification are as:

DelimitersClassification
( )    [ ]     { }Grouping
.         ,        :       ;      @Punctuation
=       +=      -=       *=     /=      //=      %=       **=Arithmetic assignment/binding
&=     |=     ^=       <<=         >>=Bitwise assignment/binding

We write grouping and punctuation delimiters as one character symbols. As you can see in the above table, the assignment/binding delimiters include (=) and any multi-character delimiters end with equal sign (=).

In the Python programming language, we use delimiters in the various sections such as to build expression, string literals, tuples, lists, or dictionaries.


Let’s take an example in which we will use different delimiters in the following statements.

Program code:

# A string literal with a single quote delimiter.
msg = 'Welcome to Scientech Easy, Dhanbad'

# A list with a square braces delimiter ([ ]).
num = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]

# A tuple with parenthesis delimiter ( () ).
fruits = ('Banana', 'Orange', 'Mango', 'Apple')

# A dictionary with curly braces ({ }) delimiter.
emp_profile = {"Name" : "John",
               "Age" : 25,
               "Salary" : 50000}

print(msg)
print(num)
print(fruits)
print(emp_profile)
Output:
       Welcome to Scientech Easy, Dhanbad
       [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
       ('Banana', 'Orange', 'Mango', 'Apple')
       {'Name': 'John', 'Age': 25, 'Salary': 50000}

In this tutorial, we have discussed Python delimiters with various examples. Hope that you will have understood all the basic points concerning with various delimiters.
Thanks for reading!!!
Next ⇒ Escape sequence in Python⇐Prev Next ⇒

Please share your love