pythonpython-3.xsubprocess

what does these print(check_output(["ls", "../input"]).decode("utf8")) mean?


from subprocess import check_output

print(check_output(["ls", "../input"]).decode("utf8"))

the code is from here https://www.kaggle.com/itoeiji/deep-reinforcement-learning-on-stock-data

I know little python,so can't understand what's the purpose of these codes.


Solution

  • Calling check_output does the command specified, ls ../input, which lists the folder input up a directory.

    Then it decodes the command result for it which is in utf-8.

    And then it prints it for you to see it.