<br><div class="gmail_quote">On Tue, Oct 26, 2010 at 3:31 AM, Sean Carolan <span dir="ltr">&lt;<a href="mailto:scarolan@gmail.com">scarolan@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">

I&#39;m rewriting a bunch of my bash scripts to get some python practice.<br>
There are some instances where python doesn&#39;t have the built-in text<br>
processing that I need, so I&#39;m using subprocess.call.  How can I pass<br>
a python variable to these subprocesses?  For example:<br>
<br>
mydir = &quot;/usr/local/bin&quot;<br>
subprocess.call(&quot;ls -l /usr/local/bin&quot;, shell=True)<br>
<br></blockquote><div>subprocess.call(&quot;ls -l &quot;+mydir,shell=True) <br>will do the job. In python, we can simply concatenate the strings like that.<br><br></div><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">


How do I replace /usr/local/bin in the subprocess call with the mydir variable?<br>
_______________________________________________<br>
Tutor maillist  -  <a href="mailto:Tutor@python.org">Tutor@python.org</a><br>
To unsubscribe or change subscription options:<br>
<a href="http://mail.python.org/mailman/listinfo/tutor" target="_blank">http://mail.python.org/mailman/listinfo/tutor</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Abhijeet Rastogi (shadyabhi)<br><a href="http://www.google.com/profiles/abhijeet.1989" target="_blank">http://www.google.com/profiles/abhijeet.1989</a><br>