Re: Simple Python equivalent for the shell command

2016-11-28 Thread Michael Torrie
On 11/28/2016 08:55 AM, Michael Torrie wrote: > Well Bash is really good at some things. Piping commands together is > one of those things. Python can do such things but not in as compact a > way. For one Python has no quick way of interfacing with subprograms as > if they were language-level co

Re: Simple Python equivalent for the shell command

2016-11-28 Thread Michael Torrie
On 11/28/2016 08:08 AM, Ganesh Pal wrote: > I was trying to write a function that will return me the unique number > associated with each employee id.The command has the output in the below > pattern > > Linux-Box-1# employee_details ls > List of names: > 100910bd9 s7018 > 100d60003 s7019 > 1106

Re: Simple Python equivalent for the shell command

2016-11-28 Thread Ganesh Pal
I remembered that I might need to add an else condition if the emp_num does not exist , so re sending the updated code def get_unique_number(str(emp_id)): """ Return the unique number associated with each employee id """ out, err, rc = run("employee_details ls", timeout=600) emp_unum

Simple Python equivalent for the shell command

2016-11-28 Thread Ganesh Pal
I was trying to write a function that will return me the unique number associated with each employee id.The command has the output in the below pattern Linux-Box-1# employee_details ls List of names: 100910bd9 s7018 100d60003 s7019 110610bd3 s7020 100d60002 s7021 Linux-Box-1# employee_details