monica_b1998@lemmy.world to Python@programming.dev · 4 days agoPython String Formatting: f-strings vs .format() vs %slicker.meexternal-linkmessage-square15fedilinkarrow-up142
arrow-up142external-linkPython String Formatting: f-strings vs .format() vs %slicker.memonica_b1998@lemmy.world to Python@programming.dev · 4 days agomessage-square15fedilink
minus-squareitsathursday@lemmy.worldlinkfedilinkarrow-up4·4 days agoWhat annoyed me moving from % to format was the loss of “formatting” floats to integers with “{:d}”, now you get a ValueError
minus-squareZoteTheMighty@lemmy.ziplinkfedilinkarrow-up5·3 days ago{:.0f} always works though for floats or ints
What annoyed me moving from % to format was the loss of “formatting” floats to integers with “{:d}”, now you get a ValueError
{:.0f}always works though for floats or intsAh nice one