Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to split string with comma in python

# We can use the split() function and put a "," in the parameter 
# It'll return a list with the string split up by commas.
txt = "hello, my name is Peter, I am 26 years old"

x = txt.split(",")
print(x)
Comment

split a string by comma in python

str = 'apple,orange,grape'

#split string by ,
chunks = str.split(',')

print(chunks)
Comment

PREVIOUS NEXT
Code Example
Python :: django date formatting 
Python :: get number of rows pandas 
Python :: sort series in ascending order 
Python :: python file open 
Python :: http server 
Python :: python count bits 
Python :: Python Excel merge cell 
Python :: render template in django 
Python :: django drop all tables 
Python :: python class 
Python :: get columns by type pandas 
Python :: use a dictionary to make a column of values 
Python :: python substitute multiple letters 
Python :: finding the rows in a dataframe where column contains any of these values python 
Python :: python request response json format 
Python :: scroll down selenium python 
Python :: yahoo finance api python 
Python :: pil crop image 
Python :: python Correlation matrix of features 
Python :: python try except 
Python :: pandas divide one column by another 
Python :: conda environment 
Python :: convert a dictionary to pandas dataframe 
Python :: how to delete a variable python 
Python :: python subprocess print stdout while process running 
Python :: NumPy unique Example Get the counts of each unique value 
Python :: django ModelChoiceField value not id 
Python :: pythn programme for adding user unputs 
Python :: flask tutorials 
Python :: non-integer arg 1 for randrange() 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =