Linked Questions

43 questions linked to/from Working with UTF-8 encoding in Python source
326 votes
7 answers
470k views

I tried this code in Python 2: def NewFunction(): return '£' But I get an error message that says: SyntaxError: Non-ASCII character '\xa3' in file '...' but no encoding declared; see http://www....
0 votes
2 answers
158 views

when I prefix my .py file using utf-8 or Latin-1 I always get bad charcacters in OUTPUT or in matplotlib figure text. Post 'Working with UTF-8 encoding in Python source' does not answer my question ...
181 votes
6 answers
99k views

PEP 263 defines how to declare Python source code encoding. Normally, the first 2 lines of a Python file should start with: #!/usr/bin/python # -*- coding: <encoding name> -*- But I have seen a ...
Oli's user avatar
  • 16.1k
165 votes
4 answers
110k views

I am using Python 2.6.5. My code requires the use of the "more than or equal to" sign. Here it goes: >>> s = u'\u2265' >>> print s >>> ≥ >>> print "{0}".format(s)...
Kit's user avatar
  • 31.7k
5 votes
3 answers
33k views

I have this line of code in python print 'hello world' against print ('hello world') can someone tell me the difference between the two? I used it in a a simple code var = 3 if var > 2: ...
Trigger's user avatar
  • 107
6 votes
3 answers
28k views

I'm using python 2.7. I've tried many things like codecs but didn't work. How can I fix this. myfile.txt wörd My code f = open('myfile.txt','r') for line in f: print line f.close() Output s\...
Rckt's user avatar
  • 185
6 votes
3 answers
19k views

Im starting with python and when i use the interpreter and run this code: >>>peliculas = ["movie1", "movie2", "movie3", "movie4"] >>>print(peliculas[1]) when i use Pycharm IDE it ...
anon's user avatar
  • 97
7 votes
3 answers
8k views

Question: How can i solve no-ascii character error executing pserve on virtualenv in windows? Description: I'm trying to execute pserve (pyllons/pyramid development web server) inside a virtualenv on ...
4 votes
2 answers
2k views

Recently, I have been reading about the Python source code encoding, especially PEP 263 and PEP 3120. I have the following code: # coding:utf-8 s = 'abc∂ ́ƒ©' ƒ = 'My name is' ß = ' ̊ß ̇ˆ†ˆ∆ ßå®åø©ˆ' ...
0 votes
1 answer
14k views

While I managed to get all the data that I need as well as save it on a cv file, the output I get is in UTF-8 format, which is normal(correct me If I'm wrong) TBH I've already "played" with the ....
1 vote
2 answers
5k views

i am selecting values from a MySQL // Maria DB that contains latin1 charset with latin1_swedish_ci collation. There are possible characters from different European language as Spanish ñ, German ä or ...
2 votes
2 answers
5k views

I am trying to write characters with double dots (umlauts) such as ä, ö and Ö. I am able to write it to the file with data.encode("utf-8") but the result b'\xc3\xa4\xc3\xa4\xc3\x96' is not nice (UTF-8 ...
hhh's user avatar
  • 53.3k
3 votes
1 answer
2k views

I am using the following code to scrape a webpage that contains Japanese characters: import urllib2 import bs4 import time url = 'http://www.city.sapporo.jp/eisei/tiiki/toban.html' pagecontent = ...
shapeare's user avatar
  • 4,243
2 votes
2 answers
3k views

Using PyMongo 3.10.1, MongoDB 4.2 the aggregation below, using $group with $regexMatch works OK on command line: db.accounts.aggregate([ {'$lookup': {'from': 'users', 'localField': '_id', '...
gcw's user avatar
  • 1,625
0 votes
2 answers
4k views

I keep getting an error and I'm not sure on how to fix it. The Code line: if not len(lines) or lines[-1] == '' or lines[-1] == '▁': lines = list(filter(lambda line: False if line == '' or line ==...

15 30 50 per page
1
2 3