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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With