1
我想从日志中打印文件的特定内容.. 对于文件中的每一行 - 打印整行。代替th打印日志文件的特定行 - Python
with open(sys.argv[1], 'r') as f:
for line in f:
if "Trace log :" in line:
print line
这工作正常。
如果我想更详细地描述该行: if "Trace log : {"request":{"http"":
然后打印跟踪日志内容;出错。
if "Trace log : {"request":{"http"":
^
语法错误:无效的语法
任何帮助,将不胜感激。
改为使用此参数:''Trace log:{“request”:{“http”''(note single quotation)。或者你可以引用* internal *'“':'”跟踪日志:{\“request \”:{\“http \”“' – Maroun
我附上了一个样本日志,我得到跟踪之前的数据我只想跟踪日志的内容 –
您是否看过我的第一条评论? – Maroun