with open('fileName', 'w') as f:
f.write(yourString)
where
>>> yourString = """MY_FILE = E:\test.jpg
BAND_SUBSET = ( 1 0 0 )
SPATIAL_SUBSET1 = ( 25.0 50.0 )
SPATIAL_SUBSET2 = ( 25.0 50.0 )
PARA1 = (
0.0 0.0 0.0
0.0 0.0 0.0 )
END = END"""
You could replace the values by using the following code.
with open('fileName', 'w') as f:
f.write(yourString.format(band_subset, spatial_subset_1, spatial_subset_2, para1))
where
yourString = """MY_FILE = E:\test.jpg
BAND_SUBSET = {}
SPATIAL_SUBSET1 = {}
SPATIAL_SUBSET2 = {}
PARA1 = {}
END = END"""
Always use the help function or consult The Python Docs.
write(...)
write(str) -> None. Write string str to file.