title: Python - % Symbol and Invalid Syntax
body: <p>I'm creating a Python script for my Raspberry Pi Radio. The Pi used mpd/mpc to play music, and I can type in the following command in Terminal to see information about the currently playing station:</p>
  
  <pre><code>mpc current -f "[%position%]"
  </code></pre>
  
  <p>This will show me:</p>
  
  <pre><code>11
  </code></pre>
  
  <p>As the 11th radio station is playing.</p>
  
  <p>My problem is, when I put this in Python to extract this number to use as part of my code, it gives me this: <strong>(I get a ^ under the first % symbol)</strong></p>
  
  <pre><code>f=os.open("mpc current -f "[%position%]"")                      
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>This seems odd as I have already used similar commands in a Python script which have worked, however they have not had the % symbol in them. Such as:</p>
  
  <pre><code>  f=os.popen("mpc current")
  </code></pre>
  
  <p>I am still learning Python so would appreciate it if someone could correct me here, as the command seems legit to me, especially with the "" either side. I even tried using ' instead of ", but if I do, the command doesn't work.</p>