Created
January 23, 2024 10:39
-
-
Save jgs03177/6b6153571a490e33d3e113e262dbab45 to your computer and use it in GitHub Desktop.
Code amalgamation example (python)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# python file amalgamation example (amalgamate cpython into one file) | |
import os | |
target_folder_name = r"repo\cpython" | |
output_file_name = "cpython.txt" | |
with open(output_file_name, "xb") as o_f: | |
for root, dirs, files in os.walk(target_folder_name): | |
for name in files: | |
_, ext = os.path.splitext(name) | |
if ext != ".c": | |
continue | |
current_filename = os.path.join(root, name) | |
with open(current_filename, "rb") as c_f: | |
o_f.write(c_f.read()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment