I'm creating a composite string for memorize id and sub id like this:
1.1
1.2
1.3
in this way:
main_id=1 #not related to sub_id
sub_id= 1 #or more by increment
item = str(main_id)+"."+str(sub_id))
It works well when i pass to a number into a string. Keep the zeros. Example: 1 and using number i can increment the substring without any problem. 1.1 -> 1.2 -> 1.19 -> 1.20 - not 2.0 if I use float.
The main problem come if i want to return to a numeric type like float.
There is some way to return into a numeric type (float or other one) and keep the string content without lose anything information?
'1.20'
into afloat
that isn't1.2
?1.20
is mathematically equivalent to1.2
.