Pad String with Zeros or any other character

Hello, 

I am new to python.

I am working on some basic problem, where i need to store numbers in XXXXX format into a CSV file.

For the integers I am able to get this format, but when i store it into CSV it again gets removed and on CSV load i find then format mismatch

I need some mechanism to pad the required zeros while saving the records to CSV as string, so that it gets loaded accordingly.

My current code is

int_var = 1
print("{:05d}".format(int_var))

output:

00001

but when revise the code to below, the output changes

int_var = 1
print("{:05d}".format(int_var))

str_var = str(int_var)
print(str_var)

output:

00001
1

whereas, i want the result of both the print statement to be "00001".

Please help me on this.