Python Tricks #10 - Printing a list

Words
0
Reading
0 min
Listen
Play
7y
# Declaring the list geek 
>>> geek = ['Geeks', 'Programming', 'Algorithm', 'Article'] 

# Directly printing the list 
>>> print ("Simple List:", geek) 
Simple List: ['Geeks', 'Programming', 'Algorithm', 'Article']

# Printing the list by join method 
>>> print ('List by using join method: %s' % ', ' .join(geek)) 
List by using join method: Geeks, Programming, Algorithm, Article

# Direct use of join method - this works nicely in Python 3
>>> print ('Direct apply the join method:',(", " .join(geek))) 
Direct apply the join method: Geeks, Programming, Algorithm, Article
Python Tricks #10 - Printing a list | Ecency