Linked Questions
24 questions linked to/from Python string prints as [u'String']
-2 votes
1 answer
934 views
Extra "u" when converting from json to csv in python [duplicate]
I try to convert from json to csv, But there is Extra letter "u" has been appeared before every word in list , i used pandas to read this csv data, this is my code : import json import csv with open(...
0 votes
1 answer
148 views
How can I access elements in a tuple? [duplicate]
A query to a database returns a tuple like this: (u'Elia extends Feyenoord deal',) Now I want to strip this down to the part which is in single quotes only, like a string. Something like: 'Elia ...
-2 votes
2 answers
64 views
python returning a strangely formatted string [duplicate]
I'm trying to edit a Python module, but I'm not getting the value I expect from a variable. The code is: def populate_ipv4_interfaces(self, data): for key, value in data.items(): vrf =...
-1 votes
1 answer
70 views
How do I strip the leading u on each item in a list? [duplicate]
My list contains a number of stock symbols but for some reason everyone has a leading u. I was wondering how I could strip the u away? This is the list [u'GOLD', u'AEM', u'CDE', u'CLF', u'FOE', u'HL',...
-3 votes
1 answer
64 views
Printing the objects instead of the keys [duplicate]
import json def read_json(filename): dt = {} fh = open(filename, "r") dt = json.load(fh) return dt def print_values_order_by_keys(dt): sorted_keys = sorted(dt) print ...
346 votes
5 answers
338k views
What's the u prefix in a Python string?
Like in: u'Hello' My guess is that it indicates "Unicode", is that correct? If so, since when has it been available?
141 votes
2 answers
137k views
What does the 'u' symbol mean in front of string values? [duplicate]
Yes in short i would like to know why am I seeing a u in front of my keys and values. I am rendering a form. The form has check-box for the particular label and one text field for the ip address. I ...
5 votes
4 answers
1k views
Why does Python 2's raw_input output unicode strings?
I tried the following on Codecademy's Python lesson hobbies = [] # Add your code below! for i in range(3): Hobby = str(raw_input("Enter a hobby:")) hobbies.append(Hobby) print hobbies With ...
5 votes
2 answers
4k views
Scrapy convert from unicode to utf-8
I've wrote a simple script to extract data from some site. Script works as expected but I'm not pleased with output format Here is my code class ArticleSpider(Spider): name = "article" ...
1 vote
1 answer
10k views
Iterate through worksheets in workbook- Python Nested For loop
I am trying to open an excel workbook and iterate through each of the worksheets in a loop. Here is first loop: wb = openpyxl.load_workbook('snakes.xlsx') for i in wb.worksheets: i= 0 wb....
-1 votes
1 answer
4k views
JSON into a List of Lists - Python
I have got the following .json file that has to be converted into a Python list of lists for further analysis. Here is how the input looks like: [{"RFA_2F":4,"RFA_2A":"E","TARGET_B":0,"LASTGIFT":5,"...
1 vote
1 answer
3k views
Hashtags python html
I want to extract all the hashtags from a given website: For example, "I love #stack overflow because #people are very #helpful!" This should pull the 3 hashtags into a table. In the website I am ...
0 votes
2 answers
1k views
Converting list of strings with u'...' to a list of normal strings [duplicate]
I'm a newbie in python. And apologies for a very basic question. I'm working with python pattern.en library and try to get the synonyms of a word. this is my code and is working fine. from pattern....
0 votes
1 answer
1k views
Print Dictionary Value From Key Without The Unicode [u'STRING]
I am adding to a dictionary by doing .append within python theDict = defaultdict(list) theDict[theKey].append(theValue) I'll try to print it out via print theDict[valueKeyToLookUp] But it always ...
1 vote
2 answers
2k views
using beautifulsoup to find_all in an array only returning first few results
I've successfully used BeautifulSoup to iterate through a few hundred pages of the bandsintown webpage, viewed here: https://www.bandsintown.com/?came_from=257&page=102 I'm able to iterate ...