Grep and Python

后端 未结 7 766
暗喜
暗喜 2020-12-02 09:36

I need a way of searching a file using grep via a regular expression from the Unix command line. For example when I type in the command line:

python pythonfi         


        
7条回答
  •  长情又很酷
    2020-12-02 10:06

    1. use sys.argv to get the command-line parameters
    2. use open(), read() to manipulate file
    3. use the Python re module to match lines

提交回复
热议问题