View Full Version : python frame padding not working (only strips zeros, doesn't add)

08 August 2012, 04:16 PM
I'm trying to pad zeroes on a variable and for some reason this only strips them:

int $maxFrameCountOBJLong = 00940;//this will be $n in a for loop
int $maxFrameCountOBJ = `python ("'%07d' % "+$maxFrameCountOBJLong)`;

08 August 2012, 04:33 PM
You lose the zeroes when you go from a string to an integer.

From the history log, the evaluation results:

int $maxFrameCountOBJLong = 00940;
// Result: 940 //
python ("'%07d' % "+$maxFrameCountOBJLong);
// Result: 0000940 //

08 August 2012, 04:35 PM
you defined your variables as integers. if you define them as strings it should work:

string $maxFrameCountOBJLong = 00940;
string $maxFrameCountOBJ = `python ("'%07d' % "+$maxFrameCountOBJLong)`;

08 August 2012, 06:15 PM
ya, that works thx

CGTalk Moderation
08 August 2012, 06:15 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.