<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Message</TITLE>
<META content="MSHTML 6.00.2800.1276" name=GENERATOR></HEAD>
<BODY>
<DIV><SPAN class=000345818-09012004><FONT face=Arial size=2>Hey, I'm brand
spanking new to python, but I'm loving it. I've begun writing my
first program that will run as a temperature monitor/recorder. I'm keeping
track of unit IP's in a mysql database, and I've written a function to pull them
out, problem is when I retrieve my 'list' of IP's from the databse, I get the
info as a list, with each IP surrounded by ( and " i.e.
(("10.1.1.205"),("10.1.1.206")) and I'm using strip() several times to get
rid of the excess so that I can re-use the IP address when gathering my
data. Here's the code, I hope this all makes sense.
</FONT></SPAN></DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial size=2></FONT></SPAN><SPAN
class=000345818-09012004><FONT face=Arial size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial size=2>## Setup MySQL
connection:</FONT></SPAN></DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial
size=2>conn=MySQLdb.connect(host=SQLHOST, user=SQLUSER, db=SQLDATA
passwd=SQLPASS) <BR>cursor=conn.cursor()
## Setup MySQL cursor<BR>cursor.execute("SELECT * FROM ip") ## My list of
IP address where my devices are
located<BR>ip=cursor.fetchall()</FONT></SPAN></DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial size=2>## At this point ip
looks like this: (("10.1.1.205"),("10.1.1.206"))</FONT></SPAN></DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial size=2>for x in
range(len(ip)): <BR>
alpha=IP_strip(str(ip[x])) <BR>
config=getConfig(alpha) ##Custom function that uses httplib to get a page
from my device over the network.<BR></FONT></SPAN></DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial size=2>def
IP_strip(ip):<BR> alpha=string.strip(ip,
")")<BR> alpha=string.strip(alpha, "(")<BR>
alpha=string.strip(alpha, ",")<BR>
alpha=string.strip(alpha,"'")<BR> return
alpha</FONT></SPAN></DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial size=2>I'm wondering if
there's any functions/methods that will strip the info in fewer lines. Or
if there's another way of retrieving my information so that I won't have to
strip it.</FONT></SPAN></DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV><SPAN class=000345818-09012004><FONT face=Arial
size=2>-Stryder</DIV></FONT></SPAN></BODY></HTML>