Parsing log in SQL DB to change IPs to hostnames

Steve Holden steve at holdenweb.com
Wed Apr 11 12:44:36 EDT 2007


KDawg44 wrote:
[ ... ]
> 
> ohhh okay.  thanks so much.  I knew that it came out as strings, i
> guess it makes sense that I would have to send it back IN as a
> string.  Changed that and now it works!  THanks so much.
> 
> I just specified once specific field so that it would not change the
> whole db on a test run.
> 
> Thanks so much.
> 
It's great that you solved your problem, but please disabuse yourself of 
the notion that the database returns everything as strings:

  >>> curs.execute("SELECT * from contact")
  >>> data = curs.fetchone()
  >>> for item in data:
  ...   print type(item)
  ...
<type 'int'>
<type 'str'>
<type 'str'>
<type 'int'>
<type 'int'>
<type 'NoneType'>
<type 'NoneType'>
  >>>

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb     http://del.icio.us/steve.holden
Recent Ramblings       http://holdenweb.blogspot.com




More information about the Python-list mailing list