I am using an update cursor to update one field based on the content of another. I can't get part of the Python script I've written to properly handle the underscore special character that is present in my data. I think I need to do something to ensure the string is read as unicode and not ascii, but I cannot figure out how to do this when referring to an index value. Can someone help? (Below is not the real script but it is the part that I am having trouble with.)
<SPAN class="keyword token">with</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>UpdateCursor <SPAN class="punctuation token">(</SPAN>in_table<SPAN class="operator token">=</SPAN><SPAN class="string token">"Test"</SPAN><SPAN class="punctuation token">,</SPAN> field_names<SPAN class="operator token">=</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">"CATS"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"DOGS"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="keyword token">as</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> cursor<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">if</SPAN> str<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>upper<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">)</SPAN> <SPAN class="operator token">not</SPAN> <SPAN class="keyword token">in</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">"PIZZA"</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">"N_A"</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">:</SPAN>
row<SPAN class="punctuation token">[</SPAN><SPAN class="number token">1</SPAN><SPAN class="punctuation token">]</SPAN> <SPAN class="operator token">=</SPAN> <SPAN class="number token">12345</SPAN>
cursor<SPAN class="punctuation token">.</SPAN>updateRow<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">del</SPAN> cursor<SPAN class="punctuation token">,</SPAN> row<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>