How to Use Join Keyword in Python


In this example, we will learn how to merge different strings into one with the join function in Python.

Source Code

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

L = ['af','cd','sa','fd','sa','f','d','s','a']
s1 = ','.join(str(n) for n in L)
print(s1)

Output:

af,cd,sa,fd,sa,f,d,s,a
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments