Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/277.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在一系列行中查找字符串,并在某个特定行之后选择所有字符串并将其附加到另一个文件中_Python_Perl - Fatal编程技术网

Python 在一系列行中查找字符串,并在某个特定行之后选择所有字符串并将其附加到另一个文件中

Python 在一系列行中查找字符串,并在某个特定行之后选择所有字符串并将其附加到另一个文件中,python,perl,Python,Perl,我的文件1内容如下 wire x; wire y; input a; input b; input c; reg m; reg n; 我必须以以下方式将信号a,b,c仅放入另一个文件文件2 assign inst.a=; assign inst.b=; assign inst.c=; 有人能用Perl或Python帮我解决这个问题吗?这是一行Perl程序 perl -lne 'print "assign inst.$1=;" if /^input\h+(\w+);/' 'file 1' 所

我的
文件1
内容如下

wire x;
wire y;
input a;
input b;
input c;
reg m;
reg n;
我必须以以下方式将信号
a
b
c
仅放入另一个文件
文件2

assign inst.a=;
assign inst.b=;
assign inst.c=;

有人能用Perl或Python帮我解决这个问题吗?

这是一行Perl程序

perl -lne 'print "assign inst.$1=;" if /^input\h+(\w+);/' 'file 1'

所以这不是一个代码编写服务。听起来像是一个工作机会。这是我的价格:15美元/小时,我接受银行转账和比特币:)