split a variable into multiple variables in python

Do you want to know the information regarding “split a variable into multiple variables in python”. If yes, you’re in the correct article.

split a variable into multiple variables in python

variable = "Hello, my name, is, ect"

#The seperate varibles ("a,b,c,d")     
a, b, c, d = variable.split(",") # What we are splitting the variable with (",") 

print(f"a \n b \nc \nd")
# Our output would be:
'''
Hello
my name
is
ect
'''

Final Words

I hope this tutorial helps you to know about “split a variable into multiple variables in python”. If you have any queries regarding this post please let us know via the comment section. Share this tutorial with your friends & family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment