need help with styling.
c_code = """
//This is an auto-generated file, please don't edit.
#include <stdio.h>
int main(){
return 0;
}
"""
file = open('main.c', 'w')
file.write(c_code)
file.close()
I have this simple code that will generate a c file from a python string. Is there a way to write the code after formatting in c style to the file? Instead of me explicitly indenting all code in the string?
So instead of this:
//This is an auto-generated file, please don't edit.
#include <stdio.h>
int main(){
return 0;
}
I need this:
//This is an auto-generated file, please don't edit.
#include <stdio.h>
int main() {
return 0;
}
Is there a library that can do this? Thanks in advance.