Writes a string to a given file. Args: filename: string, path to a file file_content: string, contents that need to be written to the file Raises: errors.OpError: If there are errors during the operation.
(filename, file_content)
| 334 | |
| 335 | |
| 336 | def write_string_to_file(filename, file_content): |
| 337 | """Writes a string to a given file. |
| 338 | |
| 339 | Args: |
| 340 | filename: string, path to a file |
| 341 | file_content: string, contents that need to be written to the file |
| 342 | |
| 343 | Raises: |
| 344 | errors.OpError: If there are errors during the operation. |
| 345 | """ |
| 346 | with FileIO(filename, mode="w") as f: |
| 347 | f.write(file_content) |
| 348 | |
| 349 | |
| 350 | @tf_export(v1=["gfile.Glob"]) |