0

There is a set of python files in a folder. One file includes a class definition, for instance

Class DataGen:

How can I know which python file in this folder use this Class? Are there any linux command that can allows me do this kind of search?

  • Is this all the ways that python could refer to the class? – Jeff Schaller Apr 8 '18 at 2:26
-1

Try grep -R DataGen . to recursively search your working directory for files that contain "DataGen".

  • 2
    If you use grep -R with *.py it will only recurse into directories that are named something that matches *.py, directories with a .py "extension", which is unlikely to do what you want... Instead, specify the current directory instead: grep -R DataGen ., that should be more helpful... – filbranden Apr 8 '18 at 3:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.