For example, I need to generate cpp code with python.
Let's assume
int x;
double y;
Note: it can be other types.
How can I generate equal spaces ?
I want to get:
int x;
double y;
For example, I need to generate cpp code with python.
Let's assume
int x;
double y;
Note: it can be other types.
How can I generate equal spaces ?
I want to get:
int x;
double y;
Use str
formating:
>>> "{:<10}{};".format("int", "x")
'int x;'
>>> "{:<10}{};".format("double", "y")
'double y;'