| 1 |
|
|---|
| 2 |
|
|---|
| 3 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|---|
| 4 | "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 | <html xmlns="http://www.w3.org/1999/xhtml">
|
|---|
| 8 | <head>
|
|---|
| 9 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|---|
| 10 |
|
|---|
| 11 | <title>Examples — pyfact 0.1 documentation</title>
|
|---|
| 12 |
|
|---|
| 13 | <link rel="stylesheet" href="_static/default.css" type="text/css" />
|
|---|
| 14 | <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
|
|---|
| 15 |
|
|---|
| 16 | <script type="text/javascript">
|
|---|
| 17 | var DOCUMENTATION_OPTIONS = {
|
|---|
| 18 | URL_ROOT: '',
|
|---|
| 19 | VERSION: '0.1',
|
|---|
| 20 | COLLAPSE_INDEX: false,
|
|---|
| 21 | FILE_SUFFIX: '.html',
|
|---|
| 22 | HAS_SOURCE: true
|
|---|
| 23 | };
|
|---|
| 24 | </script>
|
|---|
| 25 | <script type="text/javascript" src="_static/jquery.js"></script>
|
|---|
| 26 | <script type="text/javascript" src="_static/underscore.js"></script>
|
|---|
| 27 | <script type="text/javascript" src="_static/doctools.js"></script>
|
|---|
| 28 | <link rel="top" title="pyfact 0.1 documentation" href="index.html" />
|
|---|
| 29 | <link rel="next" title="phyton in FACT" href="python.html" />
|
|---|
| 30 | <link rel="prev" title="Classes" href="classes.html" />
|
|---|
| 31 | </head>
|
|---|
| 32 | <body>
|
|---|
| 33 | <div class="related">
|
|---|
| 34 | <h3>Navigation</h3>
|
|---|
| 35 | <ul>
|
|---|
| 36 | <li class="right" style="margin-right: 10px">
|
|---|
| 37 | <a href="genindex.html" title="General Index"
|
|---|
| 38 | accesskey="I">index</a></li>
|
|---|
| 39 | <li class="right" >
|
|---|
| 40 | <a href="python.html" title="phyton in FACT"
|
|---|
| 41 | accesskey="N">next</a> |</li>
|
|---|
| 42 | <li class="right" >
|
|---|
| 43 | <a href="classes.html" title="Classes"
|
|---|
| 44 | accesskey="P">previous</a> |</li>
|
|---|
| 45 | <li><a href="index.html">pyfact 0.1 documentation</a> »</li>
|
|---|
| 46 | </ul>
|
|---|
| 47 | </div>
|
|---|
| 48 |
|
|---|
| 49 | <div class="document">
|
|---|
| 50 | <div class="documentwrapper">
|
|---|
| 51 | <div class="bodywrapper">
|
|---|
| 52 | <div class="body">
|
|---|
| 53 |
|
|---|
| 54 | <div class="section" id="examples">
|
|---|
| 55 | <h1>Examples<a class="headerlink" href="#examples" title="Permalink to this headline">¶</a></h1>
|
|---|
| 56 | <div class="section" id="calling-a-system-command">
|
|---|
| 57 | <h2>calling a system command<a class="headerlink" href="#calling-a-system-command" title="Permalink to this headline">¶</a></h2>
|
|---|
| 58 | <p>Using the os module any command executable on the command line can be called within a script. This is in particular true for your own python scripts:</p>
|
|---|
| 59 | <div class="highlight-python"><div class="highlight"><pre><span class="kn">import</span> <span class="nn">os</span>
|
|---|
| 60 | <span class="n">os</span><span class="o">.</span><span class="n">system</span><span class="p">(</span><span class="s">'echo long listing of dir; pwd; ls -l'</span><span class="p">)</span>
|
|---|
| 61 | </pre></div>
|
|---|
| 62 | </div>
|
|---|
| 63 | <p>or suppose you created a script my_script.py:</p>
|
|---|
| 64 | <div class="highlight-python"><div class="highlight"><pre><span class="kn">from</span> <span class="nn">os</span> <span class="kn">import</span> <span class="n">system</span>
|
|---|
| 65 | <span class="n">system</span><span class="p">(</span><span class="s">'python my_scrip.py'</span><span class="p">)</span>
|
|---|
| 66 | </pre></div>
|
|---|
| 67 | </div>
|
|---|
| 68 | </div>
|
|---|
| 69 | </div>
|
|---|
| 70 |
|
|---|
| 71 |
|
|---|
| 72 | </div>
|
|---|
| 73 | </div>
|
|---|
| 74 | </div>
|
|---|
| 75 | <div class="sphinxsidebar">
|
|---|
| 76 | <div class="sphinxsidebarwrapper">
|
|---|
| 77 | <h3><a href="index.html">Table Of Contents</a></h3>
|
|---|
| 78 | <ul>
|
|---|
| 79 | <li><a class="reference internal" href="#">Examples</a><ul>
|
|---|
| 80 | <li><a class="reference internal" href="#calling-a-system-command">calling a system command</a></li>
|
|---|
| 81 | </ul>
|
|---|
| 82 | </li>
|
|---|
| 83 | </ul>
|
|---|
| 84 |
|
|---|
| 85 | <h4>Previous topic</h4>
|
|---|
| 86 | <p class="topless"><a href="classes.html"
|
|---|
| 87 | title="previous chapter">Classes</a></p>
|
|---|
| 88 | <h4>Next topic</h4>
|
|---|
| 89 | <p class="topless"><a href="python.html"
|
|---|
| 90 | title="next chapter">phyton in FACT</a></p>
|
|---|
| 91 | <h3>This Page</h3>
|
|---|
| 92 | <ul class="this-page-menu">
|
|---|
| 93 | <li><a href="_sources/examples.txt"
|
|---|
| 94 | rel="nofollow">Show Source</a></li>
|
|---|
| 95 | </ul>
|
|---|
| 96 | <div id="searchbox" style="display: none">
|
|---|
| 97 | <h3>Quick search</h3>
|
|---|
| 98 | <form class="search" action="search.html" method="get">
|
|---|
| 99 | <input type="text" name="q" />
|
|---|
| 100 | <input type="submit" value="Go" />
|
|---|
| 101 | <input type="hidden" name="check_keywords" value="yes" />
|
|---|
| 102 | <input type="hidden" name="area" value="default" />
|
|---|
| 103 | </form>
|
|---|
| 104 | <p class="searchtip" style="font-size: 90%">
|
|---|
| 105 | Enter search terms or a module, class or function name.
|
|---|
| 106 | </p>
|
|---|
| 107 | </div>
|
|---|
| 108 | <script type="text/javascript">$('#searchbox').show(0);</script>
|
|---|
| 109 | </div>
|
|---|
| 110 | </div>
|
|---|
| 111 | <div class="clearer"></div>
|
|---|
| 112 | </div>
|
|---|
| 113 | <div class="related">
|
|---|
| 114 | <h3>Navigation</h3>
|
|---|
| 115 | <ul>
|
|---|
| 116 | <li class="right" style="margin-right: 10px">
|
|---|
| 117 | <a href="genindex.html" title="General Index"
|
|---|
| 118 | >index</a></li>
|
|---|
| 119 | <li class="right" >
|
|---|
| 120 | <a href="python.html" title="phyton in FACT"
|
|---|
| 121 | >next</a> |</li>
|
|---|
| 122 | <li class="right" >
|
|---|
| 123 | <a href="classes.html" title="Classes"
|
|---|
| 124 | >previous</a> |</li>
|
|---|
| 125 | <li><a href="index.html">pyfact 0.1 documentation</a> »</li>
|
|---|
| 126 | </ul>
|
|---|
| 127 | </div>
|
|---|
| 128 | <div class="footer">
|
|---|
| 129 | © Copyright 2012, Werner Lustermann.
|
|---|
| 130 | Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.2.
|
|---|
| 131 | </div>
|
|---|
| 132 | </body>
|
|---|
| 133 | </html> |
|---|