I am pretty new to python and I am stuck with something now. I am using python 2.7. I am trying to automate a command in shell for which I wrote a python script. I have to input
Finally I found the solution for this. Well the solution to this was pretty simple
when I changed
string = proc.communicate(input='2')
to
string = proc.communicate(input='2\n')
it worked fine.