I have this block of code that reliably creates a string object. I need to write that object to a file. I can print the contents of 'data' but I can't figure out how to write it to a file as output. Also why does "with open" automatically close a_string?
with open (template_file, "r") as a_string:
data=a_string.read().replace('{SERVER_NAME}', server_name).replace('{BRAND}', brand).replace('{CONTENT_PATH}', content_path).replace('{DAMPATH}', dampath).replace('{ENV}', env).replace('{CACHE_DOCROOT}', cache_docroot)
a_string.write(your_string_object)should work inside thewithblock