我正在尝试替换 Python 源文件中的每个多行导入。所以,源代码就像
from XXX import (
AAA,
BBB,
)
from YYY import (
CCC,
DDD,
EEE,
...
)
...other instructions...
我想得到类似的东西
from XXX import AAA, BBB
from YYY import CCC, DDD, EEE, ...
...other instructions...
我尝试使用 sed,但它看起来不支持右括号的非贪婪匹配,所以它“吃掉”第二个导入.. :(
任何提示?这对 sed 来说是不可能的吗?我应该尝试使用其他工具吗?