Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

convert 1 digit to 2 digit python

number = 10
print(number) #Output: 10
zero_filled_number = str(number).zfill(3)
print(zero_filled_number) #Output: "010"
Comment

how to format integer to two digit in python

You can achieve this using formatted string
num = 1
number = f"{num:02}"
--------------
output:
"01"
Comment

PREVIOUS NEXT
Code Example
Python :: python get names of all classes 
Python :: turn list of tuples into list 
Python :: list mean python 
Python :: python pip install 
Python :: flask upload file to s3 
Python :: discord.py cog 
Python :: kneighbours regressor sklearn 
Python :: python get name of file 
Python :: matplotlib bar chart value_counts 
Python :: simple colours python 
Python :: python read string from file 
Python :: remove emoji from dataframe 
Python :: logging in with selenium 
Python :: python- find multiple values in a column 
Python :: pyAudioAnalysis 
Python :: pandas read_csv nan as empty string 
Python :: youtube upload python 
Python :: python replace first 
Python :: get os environment python 
Python :: compute eigenvalue python 
Python :: Get a random joke in python 
Python :: python execute time 
Python :: python style console output 
Python :: pandas append index ignore 
Python :: python class name 
Python :: python hello world web application 
Python :: python extract text from image 
Python :: django link home page 
Python :: python empty dictionary 
Python :: bs4 python delete element 
ADD CONTENT
Topic
Content
Source link
Name
3+5 =