Linked Questions

3 votes
2 answers
14k views

Possible Duplicate: Write to utf-8 file in python I have Unicode strings (with Japanese characters) I want to write to a CSV file. However, the BOM does not seem to be written correctly, just as a ...
AntiqueZamba's user avatar
0 votes
4 answers
248 views

My current code, displays the results in both console and an output text file with the following statement fw.write("Number of files processed within 512\u00B1 1 samples: "+str(count)) My ...
Masud Syed's user avatar
1186 votes
22 answers
1.0m views

What's different between UTF-8 and UTF-8 with BOM?
simple's user avatar
  • 12k
1149 votes
16 answers
2.0m views

I'm trying to get a Python 3 program to do some manipulations with a text file filled with information. However, when trying to read the file I get the following error: Traceback (most recent call ...
Eden Crow's user avatar
  • 16.4k
4 votes
3 answers
9k views

I'm attempting to extract article information using the python newspaper3k package and then write to a CSV file. While the info is downloaded correctly, I'm having issues with the output to CSV. I don'...
sirryankennedy's user avatar
6 votes
2 answers
10k views

I want to make sure all string are unicode in my code, so I use unicode_literals, then I need to write string to file: from __future__ import unicode_literals with open('/tmp/test', 'wb') as f: f....
roger's user avatar
  • 10.1k
1 vote
4 answers
3k views

I am trying to write into a file from a collection. The collection has special characters like ¡ which create a problem. For example the content in the collection has details like: {..., Name: ¡Hi!,...
srajappa's user avatar
  • 481
0 votes
1 answer
6k views

I have a CSV that is encoded in Unicode, however lacks a byte order mark at the start. As such Excel (2013) opens without encoding correctly (i think it assumes ASCII if no BOM specified...), meaning ...
kyrenia's user avatar
  • 5,625
1 vote
1 answer
2k views

I am trying to write into a file (in Python), but it says: 'ManyRelatedManager' object has no attribute 'encode' Here is the code: self.writer.writerow([s.encode('utf-8') for s in row]) Is there a ...
doniyor's user avatar
  • 38k
1 vote
1 answer
1k views

I have a lengthy json file that contains utf-8 characters (and is encoded in utf-8). I want to read it in python using the built-in json module. My code looks like this: dat = json.load(open("data....
Scaatis's user avatar
  • 137
0 votes
2 answers
915 views

I'm reading german names from a csv, and want to write them in a csv file, with the right encoding for ä, ö and ü. Reading works fine, but when I write to the csv, the characters are displayed like ...
MJP's user avatar
  • 5,677
0 votes
1 answer
772 views

Just for fun, I am trying to create a batch renaming application in Python 3.6.0 which is supposed to capture, split the file name based on regex, and properly name the files. For testing purposes, I ...
Sometowngeek's user avatar
0 votes
0 answers
409 views

Hi everyone~ I'm new to python ~ Does anyone know that I can crawl the data(the string mix with Chinese and English) into python_job.csv and I can open with excel but the Chinese part all become ...
Often Lin's user avatar
1 vote
2 answers
328 views

I'm currently writing a short Python script to walk through some directories on a server, find what I'm looking for and save the data to an XML file. The problem is that some of the data is written ...
Ritashugisha's user avatar
1 vote
2 answers
146 views

I have a json file with several keys. I want to use one of the keys and write that string to a file. The string originally is in unicode. So, I do, s.unicode('utf-8') Now, there is another key in ...
crazyaboutliv's user avatar

15 30 50 per page