Linked Questions
69 questions linked to/from Convert a Unicode string to a string in Python (containing extra symbols)
-1 votes
1 answer
2k views
How to remove non-ASCII characters from a text file using Python and turning the file into a String
import re data2 = '' file = open('twitter.txt', 'r') for i in file: thing = re.sub(r'[^\x00-\x7f]',r'', str(file[i])) print(str(thing)) Hi, I'm very new to Python. After scraping a bunch of ...
0 votes
3 answers
1k views
Table Scraping with same class attributes
I am trying to scrape the prayer time from a website which is www.hujjat.org. Here is the html part of the area I am interested in (as you may have noticed the class attribute is the same for all ...
4 votes
2 answers
1k views
How to convert a string with unicode in it to unicode using python
I am importing a bunch of data from excel using xlrd on python I get all my data in string like this : text:u'L\xc9GENDE' I manipulate these data and I try to put them back in excel (using ...
0 votes
1 answer
1k views
Saving High Score and showing it on screen
I've finished my first game, and I'd like to add the high score to the 'game over' screen. I have a variable called 'score'. This 'score' increases as you get further into the game. This 'score' ...
1 vote
2 answers
1k views
Extract xlrd package data extraction
When i am trying to extract the data from an xlsx files. I get the encoding details with the data as well. Consider the code as shown below, column_number = 0 column_headers = [] #column_headers = ...
-2 votes
1 answer
824 views
How to transform unicode to readable string?
I have a list of urls: ['https:\\u002F\\u002Furl.net\\u002F800x600\\u002Ff031d92dc2ea2f928e475f27ff84fad2db99b01982ff846e50028f6edc71c140\\u002Fimage.jpg', 'https:\\u002F\\u002Furl.net\\u002F800x600\\...
0 votes
1 answer
1k views
Text Encoding Between Python File, Maya Script Editor, and Maya UI (Python 2.7, Maya 2015, Windows 7)
I've got a python file that I'm loading as a script into the maya script editor. The python file is currently encoded as UTF-8. I have the need to use the ↑ and ↓ characters (or any other arrow ...
0 votes
1 answer
595 views
Python - Convert unicode hex to string
I am using Readability Parser API to extract content from a web page. It is ok when the web page is in Latin character set, but when I extract article in Cyrillic, it ends up with the following: <...
0 votes
1 answer
918 views
Django string in unicode pattern
Django when i send the following string from an ajax submit i get the following string in unicode.How to decode this $.post("/records/save_t/",snddata, function(data){ if(data == 0 ){ ...
0 votes
0 answers
919 views
Unicode Using sqlite3 in Python 2.7.3
I'm trying to insert into a table, but it seems that the file I opened has non-ascii characters in it. This is the error I got: sqlite3.ProgrammingError: You must not use 8-bit bytestrings unless ...
0 votes
1 answer
630 views
python xpath remove unicode chars
I have this text in html page <div class="phone-content"> 050 2836142 </div> I extract it like this: I am using xpath to extract the ...
0 votes
1 answer
751 views
django python convert unicode in queryset
How convert u'[<Car: { surname :yass name : zazadz } >] in [<Car: { surname :yass name : zazadz } >]. So how convert unicode in django.db.models.query.QuerySet ?
3 votes
2 answers
350 views
Python split first sentence in news article and get the actual sentence using re
For most news articles, the first sentences always start with a location follows by hyphen or a comma, such as KUALA LUMPUR: North Korea and Malaysia on Monday locked horns over the investigation ...
0 votes
1 answer
733 views
how can i change python console encoding MAC OSX
I tried all in this interesting thread Changing default encoding of Python? but nothing work for me. I use sublime text and when I try : import sys print(sys.stdout.encoding) Output is : US-ASCII I ...
1 vote
0 answers
675 views
undefined key after parse the string form json.dumps() in python by JSON.parse()
I have a string returned from python by json.dumps(). I am using python 2.6 or 2.7. When I parse it using JSON.parse() in JavaScript. I got undefined with keys. My string recieved by javascript(ajax) ...