Now I have:
printf('Rating: %.2F', $rating);
which prints like:
4.00
How can I show the initial zero only if there is something to show after it?
For instance:
printf("Rating: %g\n", 4.00); printf("Rating: %g\n", 4.20); printf("Rating: %g\n", 4.02);
prints
Rating: 4 Rating: 4.2 Rating: 4.02
This way values without printf will be printed
printf
demo
Source: https://habr.com/ru/post/1382181/More articles:Test Website Update (IIS) - htmlTornado ": error [Errno 24] Too many open files" - pythonFailed to extract html table rows - htmlIs there an API for customizing user profile badges / profiles for Gnome 3? - gnomeMondrian Cannot find schema in VFS when used in Webapp - schemaWhy does the inverse Clojure function return a non-clause sequence? - lispScan CSV for variables - variablesYoutube API - processing videos deleted by Youtube - javascriptDifferences between [UIView transitionWithView ...] and [UIView transitionFromView ...] - objective-cEntity Framework NullReferenceException when creating a model - c #All Articles