Message from Python discussions
December 2018
— The best way to store splited string in a variable it store it in one variable as list
This kind of things, splitting text to get first_name
and last_name
are really tricky... how would you manage these:
- Guido van Rossum
- Richard Matthew Stallman
Which will be the first_name
and the second_name
?
— Sorry, if I confuse you
— Uh
— That's my bad English
— Or van der
— 🤷🏻♂️
splitting text to get names are really tricky, that's why it's preffered to ask and save that data in separate variables rather that just one long variable
— Https://en.wikipedia.org/wiki/Tussenvoegsel
— Yeah.
— By using the "split" function using the " " character. Something like s2 = s.split(" ")
*Note, that there is a space in quotation marks, not just an empty string.
— Then use ', '.join(text) to output the words in splitted
— Language:
py3
Source:
from decimal import Decimal
a = Decimal("2018.12")
b = Decimal("2018")
print(a-b)
Result:
0.12