4 ms·
Yeah, no need for Python. Even the following seems to work fine: $ printf "%d\n" 003 3
by neokantian 8y ago
Yeah, no need for Python. Even the following seems to work fine:
$ printf "%d\n" 003
3
- scbrg 8y agoWell, that works up to a point. Fore some, that point might be considered a bit too close to zero... $ printf "%d\n" 009 sh: 1: printf: 009: not completely converted 0
- jandrese 8y ago0-prefix octal notation continues to be a mistake. I love when programs mysteriously fail when passed an IP address like 192.168.001.009. Thankfully modern tools have been moving away from supporting that notation and are less likely to explode all over unsuspecting users.
- neokantian 8y agoYes, you are right. This seems to work better: $ printf "%1.0f\n" 009 9 $ printf "%1.0f\n" 00125990 125990
- lelf 8y ago$ printf %d 010 8