Skip to content

Commit

Permalink
python3 refactor/modernize/fix
Browse files Browse the repository at this point in the history
  • Loading branch information
shlomif committed Aug 24, 2024
1 parent ed2c104 commit 990fa44
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions topic.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ def add_toc(fn):
out_s = subprocess.Popen(
["bash", "-c", "./github-markdown-toc/gh-md-toc - < " + fn],
stdout=subprocess.PIPE).stdout.read().decode('utf-8')
out_s += open(fn).read()
with open(fn, "rt") as fh:
out_s += fh.read()
return out_s


Expand All @@ -26,7 +27,9 @@ def main(argv):
parser.add_argument('--input', type=str, required=True,
help='Input filename')
args = parser.parse_args(argv[1:])
open(args.output, "wt").write(add_toc(args.input))
output_text = add_toc(args.input)
with open(args.output, "wt") as ofh:
ofh.write(output_text)


main(sys.argv)

0 comments on commit 990fa44

Please sign in to comment.