Answers for "split input into two variables python"

10

how to split a string in python with multiple delimiters

>>> a='Beautiful, is; better*thannugly'
>>> import re
>>> re.split('; |, |*|n',a)
['Beautiful', 'is', 'better', 'than', 'ugly']
Posted by: Guest on June-09-2020
1

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} n{c} n{d}")
# Our output would be:
'''
Hello
my name
is
ect
'''
Posted by: Guest on September-29-2020

Code answers related to "split input into two variables python"

Python Answers by Framework

Browse Popular Code Answers by Language