I am writing python script, in my python script i want to run "list of files in a directory" using commands.getoutput, my probleam is "i defined the directory path in python variable like "dir_name".I tried with following.
dir_name="/user/pjanga/python_test"
index_list=commands.getoutput('ls -l',dir_name,'| 'wc -l')
Error:-
File "diii.py", line 10
index_list=commands.getoutput('ls -l',dir_name,'| 'wc -l')
^
SyntaxError: invalid syntax
Could you please help me out run?