Passing a variable, set by the user, as a parameter for a os.system() command
<p>Okay so basically I am quite new at Python, however, I would like to make a simple menu system for all my basic tools I use at work my code so far is below:</p>

<pre><code>import os
def main():
    print "Main Menu.\n"
    print "1. Ping yourself.\n"
    print "2. Ping someone else.\n"
    opt = raw_input ("Please enter a number:- ")
    if opt == "1":
            os.system('ping 127.0.0.1')
    if opt == "2":
            ip = raw_input ("Please enter IP:- ")
            os.system('ping'.ip)

main()
</code></pre>

<p>Now, that all runs fine, however I seem to be stuck on this line here:</p>

<pre><code>os.system('ping'.ip)
</code></pre>

<p>As I would like to use the variable on line 10 to be used in the command. Hope this is an easy fix.</p>

<p>Thanks,</p>

<p>Ross.</p>
