python 用于将每个列表保存到某个输出文件中并将输出文件存储在另一个目录中
python for save each list into some output file and store output file in another directory
我已经有了这个代码
#!usr.bin/env python
with open('honeyd.txt', 'r') as infile:
for index, line in enumerate(infile, 1):
with open('TA_rule_{}.rule'format(index), 'w') as outfile:
outfile.write('alert {} {} -> {} {}\n'.format(*line.split()))
此代码拆分所有行并保存到某个输出文件中。这个脚本我放在目录 /etc/snort.
输出文件存储在目录 /etc/snort
我的目标是将输出文件存储在 /etc/snort/rules
有人可以帮忙吗?
...
以 open('DiskName:\Path\etc\snort\rules\fileName.txt', 'w')
作为输出文件:
...
我已经有了这个代码
#!usr.bin/env python
with open('honeyd.txt', 'r') as infile:
for index, line in enumerate(infile, 1):
with open('TA_rule_{}.rule'format(index), 'w') as outfile:
outfile.write('alert {} {} -> {} {}\n'.format(*line.split()))
此代码拆分所有行并保存到某个输出文件中。这个脚本我放在目录 /etc/snort.
输出文件存储在目录 /etc/snort
我的目标是将输出文件存储在 /etc/snort/rules
有人可以帮忙吗?
...
以 open('DiskName:\Path\etc\snort\rules\fileName.txt', 'w')
作为输出文件:
...