Python solves the PowerDesigner annotation problem
as the picture shows:
Step 1: Write Python code
code show as below:
import os
import re
lines = (i for i in open('F:\\2\\test.txt', 'r') if '/' not in i )
f = open('F:\\2\\test_new.txt', 'w', encoding="utf-8")
f.writelines(lines)
f.close()
os.rename('test.txt', 'test1.bak')
os.rename('test_new.txt', 'test.txt')
os.remove('test1.bak')
Step 2: Create a new file:
As can be seen from the above code, our open file path is F:\2\test.txt, so
we need to create a new file. as the picture shows:
Step 3: Copy the generated Java code to the test.txt file
as the picture shows:
Step 4: Run the Python file
Remember to close the text.txt file that we posted the code just now when running, otherwise it won't work.
As shown in the figure:
After running, there is no error:
Check the test.txt file:
the effect we want has been achieved, is it more attractive?