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