Skip to content

Instantly share code, notes, and snippets.

@threecourse
Created March 15, 2019 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save threecourse/67209fe5539dc09cc928440f5f2517a3 to your computer and use it in GitHub Desktop.
Save threecourse/67209fe5539dc09cc928440f5f2517a3 to your computer and use it in GitHub Desktop.
分かれたファイルを一つに統合するスクリプト(C#コード用)
import numpy as np
import pandas as pd
if __name__ == "__main__":
import glob
files = glob.glob("src/*")
print(files)
ls_using = []
ls_main = []
for path in files:
with open(path, "r", encoding="utf-8") as f:
lines = f.readlines()
flag_using = False
flag_main = False
for i, line in enumerate(lines):
if "// CUT USING START" in line:
flag_using = True
print(line)
if "// CUT USING END" in line:
print(line)
flag_using = False
if "// CUT MAIN START" in line:
flag_main = True
print(line)
if "// CUT MAIN END" in line:
print(line)
flag_main = False
if flag_using:
ls_using.append(line)
if flag_main:
ls_main.append(line)
with open("integrated.tmp", "w", encoding="utf-8") as f:
f.writelines(ls_using)
f.write("namespace Marathon {")
f.writelines(ls_main)
f.write("}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment