python extract keywords from multiple .gz files
问题 Question: How to search keywords from multiple files in Python(including compressed gz file and uncompressed file) I have multiple archived logs in a folder, the latest file is "messages",and the older logs will auto-compressed as .gz file. -rw------- 1 root root 21262610 Nov 4 11:20 messages -rw------- 1 root root 3047453 Nov 2 15:49 messages-20191102-1572680982.gz -rw------- 1 root root 3018032 Nov 3 04:43 messages-20191103-1572727394.gz -rw------- 1 root root 3026617 Nov 3 17:32 messages