Message270958
Sorry, I thought maybe the error message would be indicative of something. Here's the re:
find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL)
Here's the program:
#! py -3
# Requires Python 3.5
# Updates generated output into extracted Java programs in "On Java 8"
from pathlib import Path
import re
import pprint
import sys
if __name__ == '__main__':
find_output = re.compile(r"/\* (Output:.*)\*/", re.DOTALL)
for outfile in Path(".").rglob("*.p1"):
print(str(outfile))
javafile = outfile.with_suffix(".java")
if not javafile.exists():
print(str(outfile) + " has no javafile")
sys.exit(1)
javatext = javafile.read_text()
if "/* Output:" not in javatext:
print(str(javafile) + " has no /* Output:")
sys.exit(1)
new_output = outfile.read_text()
new_javatext = find_output.sub(new_output, javatext)
javafile.write_text(new_javatext) |
|
Date |
User |
Action |
Args |
2016-07-21 21:09:44 | Bruce Eckel | set | recipients:
+ Bruce Eckel, tim.peters |
2016-07-21 21:09:43 | Bruce Eckel | set | messageid: <1469135383.97.0.714850033855.issue27586@psf.upfronthosting.co.za> |
2016-07-21 21:09:43 | Bruce Eckel | link | issue27586 messages |
2016-07-21 21:09:43 | Bruce Eckel | create | |
|