Scroll Down to See All▾
absaiterallanextanyasciibinboolbreakpointbytearraybytescallablechrclassmethodcompilecomplexdelattrdictdivmodenumerateevalexecfilterfloatfrozensetgetattrglobalshasattrhashhelphexidinputintisinstanceissubclassiterlenlistlocalsmapmaxmemoryviewminnextobjectoctopenordpowprintpropertyrangereprreversedroundsetsetattrslicesortedstaticmethodstrsumsupertupletypevarszip__import__clear_(dict)clear_(list)clear_(set)copy_(dict)copy_(list)copy_(set)fromkeysgetitemskeyspop_(dict)pop_(list)pop_(set)popitemsetdefaultupdatevaluescount_(tuple)count_(list)count_(str)index_(tuple)index_(list)index_(str)adddifferencedifference_updatediscardintersectionintersection_updateisdisjointissubsetissupersetremove_(set)remove_(list)symmetric_differencesymmetric_difference_updateunionupdateclosefilenoflushisattyreadreadablereadlinereadlinesseekseekabletelltruncatewritablewritewritelinesappendextendinsertreversesortcapitalizecasefoldcenterencodeendswithexpandtabsfindisalnumisalphaisasciiisdecimalisdigitisidentifierislowerisnumericisprintableisspaceistitleisupperjoinljustlowerlstripmaketranspartitionreplacerfindrindexrjustrpartitionrsplitrstripsplitsplitlinesstartswithstripswapcasetitletranslateupperdirzfillFunction Details: format
Description
Returns value.__format__(format_spec).
Extended Description
The format() function returns a formatted representation of a value as controlled by format_spec. It internally calls the __format__() method of the value. This function is the basis of the advanced string formatting operations in Python, allowing for precise control over the output format of various data types.
Exceptions
- ValueError: If an invalid format specification is provided
Read More about format from Python Documentation
Function Signature
format(value: Any, format_spec: str = '') -> str
Module: builtins
Parameters
value: The object to be formatted. format_spec: A string that specifies how the value should be formatted.
Parameter List
- value: Any
- format_spec: str
Return
Returns a formatted string representation of the value.
Return Type
str
Output
Explanation
This example shows basic number formatting with padding, precision, and thousands separator.