问题
Is there any parser out there for reading in a Pipfile and returning a list of all packages used in the Pipfile?
If not, how would one go about this? I was thinking a regular expression could do the job, but I am not sufficiently acquainted with the structure of Pipfiles to confirm that is the case.
回答1:
first install pipfile pip install pipfile
.
then just use the parser it provides
from pipfile import Pipfile
parsed = Pipfile.load(filename=pipfile_path)
来源:https://stackoverflow.com/questions/53015705/parser-for-pipfiles-get-a-list-of-all-packages-used-in-a-pipfile