Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert an integer to a comma separated string

Tags:

People also ask

How do you separate a comma separated string in Python?

Python String split() Method Python split() method splits the string into a comma separated list. It separates string based on the separator delimiter. This method takes two parameters and both are optional.

How do you separate a value from a comma in Python?

You can use the Python string split() function to split a string (by a delimiter) into a list of strings. To split a string by comma in Python, pass the comma character "," as a delimiter to the split() function. It returns a list of strings resulting from splitting the original string on the occurrences of "," .


I'm currently working on a program and I've run into a problem.

I have a bank balance of 1000000 but when I display it on the screen I want it to read as "1,000,000".

Now there are ways of getting around this simply by having it set to "1,000,000" and then striping it of commas and converting it to an integer when I need to use the integer value. But I don't want to do that.

bankBalance = 1000000