-2

echo -e "Size\tFiles\tDirectory"; paste <(du -sh ./*/ | sort -k2 | cut -f1) <(find ./*/ | cut -d/ -f2 | uniq -c | sort -k2 | awk '{print ($1-1)"\t"$2}') | sort -nk2

  1. I need output of the above shell script in python code.

  2. Is there a way to get the same output through python code or insert the above script in python code.

  3. Also I need to insert the variable in place of path ./*/ i.e my path is in the variale e.g x=/usr/bin.

Vallie
  • 689
  • 9
  • 19
  • 2
    Yes there is. What have you tried so far and where did you get stuck? – zwer Apr 05 '18 at 12:50
  • 4
    Possible duplicate of [Running Bash commands in Python](https://stackoverflow.com/questions/4256107/running-bash-commands-in-python) – OneCricketeer Apr 05 '18 at 12:53

1 Answers1

0

use can use library like subprocess ,easyprocess etc from pthon which can run commands in pythons and gives output as stdout

Hari
  • 334
  • 4
  • 16