Avatar ·

Split list elements character by character

📁 List

Hello!

Please tell me how to split a conditional list ['1', '22', '333'] by characters, i.e. to get a list ['1', '2', '2', '3', '3', '3']

Thanks in advance!

Avatar ·

Analog in Python 3.6+:

def toFixed(numObj, digits=0):    retu f""{numObj:.{digits}f}""

Example:

>>> numObj = 12345.6789>>> toFixed(numObj)'12346'>>> toFixed(numObj, 1)'12345.7'>>> toFixed(numObj, 6)'12345.678900'>>> toFixed(

Log in to leave an answer

Blogs