# Strange digit appears on list from PyDataSet

**URL:** <https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363>\
**Category:** Ignition\
**Created:** [April 27, 2012, 12:51pm UTC](https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363 "2012-04-27T12:51:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Brett\_Yeomans](https://avatars.discourse-cdn.com/v4/letter/b/35a633/32.png) [@Brett\_Yeomans](https://forum.inductiveautomation.com/u/Brett_Yeomans)\
**Post date:** [April 27, 2012, 12:51pm UTC](https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363/1 "2012-04-27T12:51:25Z")

</div>

I had this code on the click of a button which produced a list?? of column names, it has just been noticed that the results of this have changed in that every column name in the list is preceeded by a “u”, i.e. [u’Mains\_Water’, u’Hotwell\_Water’, u’Hotwell\_Steam’, u’Energy\_parasitic’]. The “u” never used to be there. Did upgrade to 7.4 a couple of weeks ago, other than that I am baffled?? ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")  
if I add “print value” into the loop the values are correct, if I add “print search” then the “u”'s appear in the console.

[code]event.source.parent.start = 1  
event.source.parent.end = 5

search =   
columns = system.dataset.toPyDataSet(event.source.parent.column\_names)  
for row in columns:  
for value in row:  
search.append(value)

event.source.parent.search = search[event.source.parent.start:event.source.parent.end]  
[/code]

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 27, 2012, 1:54pm UTC](https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363/2 "2012-04-27T13:54:03Z")

</div>

Those u’s are indicating that it’s a Python unicode string. When printing the list as a whole you should see them; this is the correct behavior.

---

<div class="post-metadata">

**Author:** ![Brett\_Yeomans](https://avatars.discourse-cdn.com/v4/letter/b/35a633/32.png) [@Brett\_Yeomans](https://forum.inductiveautomation.com/u/Brett_Yeomans)\
**Post date:** [April 27, 2012, 9:03pm UTC](https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363/3 "2012-04-27T21:03:35Z")

</div>

Oops! posted this in wrong Forum! - But how come this used to work (no “U”'s) and now errors with a fault that indicates the SQL query is wrong! When I added an extra expression to “replace” the “U”'s with “” the code then worked like it did originally!! Something has changed??? ![:scratch:](https://us1.discourse-cdn.com/inductiveautomation/original/1X/76d1620bec252bfac07050c889ff5a91dc8a9c25.gif ":scratch:")

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 27, 2012, 9:24pm UTC](https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363/4 "2012-04-27T21:24:27Z")

</div>

Hmm, not sure what you’re doing that would cause those u’s to get in the way of something. Can you post your whole script?

The change is because for 7.4 we upgraded from Jython 2.1 to Jython 2.5.

---

<div class="post-metadata">

**Author:** ![Brett\_Yeomans](https://avatars.discourse-cdn.com/v4/letter/b/35a633/32.png) [@Brett\_Yeomans](https://forum.inductiveautomation.com/u/Brett_Yeomans)\
**Post date:** [April 28, 2012, 7:13am UTC](https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363/5 "2012-04-28T07:13:20Z")

</div>

Basically the result of the code originally posted goes to a custom property type ‘string’ which I then filter using three more custom properties (all expressions using the replace function to get rid of all [] and , the end result is used in a SQL query to populate a tables data. This SQL query was where the error came as no columns were called u’Mains’, u’water’ …etc, hence the need to suddenly add a fourth replace expression to get rid of the newly appearing U’s.

I guess my whole method is too basic and the sort of thing a beginner would do but I just wanted to understand why a 3 month old screen suddendly went bad so as to avoid the same in future work.

---

<div class="post-metadata">

**Author:** ![Kevin.Herron](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/kevin.herron/32/7259_2.png) [@Kevin.Herron](https://forum.inductiveautomation.com/u/Kevin.Herron)\
**Post date:** [April 28, 2012, 2:47pm UTC](https://forum.inductiveautomation.com/t/strange-digit-appears-on-list-from-pydataset/4363/6 "2012-04-28T14:47:43Z")

</div>

Right, basically what’s happening is your relying Python’s **str** implementation for a list of strings. This changed between Python 2.1 and Python 2.5.

The **str** (toString() in Java) is not something that should be relied upon in the way you’re using it.
