Sending in String vs Reading String
<p>I have a text file that contains something like:</p>

<pre><code>IP_ADD = "10.10.150.3"
BACKUP_IP = "10.10.150.4"
</code></pre>

<p>and the code to read it in:</p>

<pre><code>counter = 0
wordList = [None] * 100

with open("config.txt") as f:
    content = f.read().splitlines()

for line in content:
    line = line.split(' ',2)[-1]
    wordList[counter] = line
    counter = counter + 1
</code></pre>

<p>which will return to me just the IP Address with the quotes inside wordList.. IE</p>

<pre><code>wordList[0] = "10.10.150.3"
</code></pre>

<p>I then try to send an SNMP command using the OID and that IP address. IE</p>

<pre><code>agent.set(MY_OID,wordList[0])
</code></pre>

<p>but this doesnt work. If I change it to the following:</p>

<pre><code>agent.set(MY_OID,"10.10.150.3")
</code></pre>

<p>it works. What am I missing here?</p>

<p>From what you wrote it appears that your file has the IP addr in quotes.
Hence</p>

<pre><code> line = line.split(' ',2)[-1]
</code></pre>

<p>will return an IP address in quotes as a string, aka</p>

<pre><code> "\"10.0.0.1\""
</code></pre>

<p>This is what you are sending across the wire, which is probably not what you intend to do.</p>

python string file io