MCPcopy Create free account
hub / github.com/geekcomputers/Python / save_summary

Function save_summary

news_oversimplifier.py:140–150  ·  view source on GitHub ↗

Appends a formatted summary to a file along with its title. args: title (str): Title of the article. summary (str): Summarized text to save. path (str): File path to save the summary, i.e. 'summaries.txt'

(title, summary, path="summaries.txt")

Source from the content-addressed store, hash-verified

138
139
140def save_summary(title, summary, path="summaries.txt"): # no pytest
141 """
142 Appends a formatted summary to a file along with its title.
143
144 args:
145 title (str): Title of the article.
146 summary (str): Summarized text to save.
147 path (str): File path to save the summary, i.e. 'summaries.txt'
148 """
149 with open(path, "a", encoding="utf-8") as f:
150 f.write(f"{title}\n{summary}\n{'=' * 60}\n")
151
152
153if __name__ == "__main__":

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected