Issue 267: pyodbc.Row' object has no attribute 'replace'
Status:  NoFix
Owner: ----
Closed:  May 2012
Reported by sembcsco...@gmail.com, May 25, 2012
Hi,

I am using the latest version of pyodbc on Ubuntu and have a small issue. 

The output pyodbc is giving me is always in the (222122L, ) format. I need to format this output to make it more readible by removing the "()" and "L". Apprently I cannot do this with a str.replace statement. Any ideas how to circumvent this?

Regards,

Ronald.


May 25, 2012
Project Member #1 mkleehammer
I think the issue is you are using the entire *row* in your string, when you really just want the first column.  A row is a set of columns and is very much like a tuple:

Instead of:
  x = 'label: %s' % row
use:
  x = 'label: %s' % row[0]

The () are being added because the row is being asked to turn itself into a "repr" string and it does the same thing as a tuple.  The 'L' is added by the value itself for the same reason.  When you extract it, %s on the value should give you just 222122. 
Status: NoFix
May 25, 2012
#2 sembcsco...@gmail.com
Tx, works like a charm!