When you open the file you want to write to, open it with a specific encoding that can handle all the characters.
with open('filename', 'w', encoding='utf-8') as f:
print(r['body'], file=f)
More Related Contents:
- SQLite not saving data between uses
- Python 3 sqlite parameterized SQL-query
- Accepting only letters as input [closed]
- How to check which list an element is contained in
- How to remove English words from a file containing Dari words?
- How can I make a time delay? [duplicate]
- How to merge multiple dicts with same key or different key?
- How does asyncio actually work?
- Why is a list comprehension so much faster than appending to a list?
- TypeError: a bytes-like object is required, not ‘str’ in python and CSV
- How do you escape strings for SQLite table/column names in Python?
- How to deal with multi-level column names downloaded with yfinance
- TypeError: worker() takes 0 positional arguments but 1 was given [duplicate]
- Python 3.7 – asyncio.sleep() and time.sleep()
- Rolling Mean on pandas on a specific column
- Inserting a table name into a query gives sqlite3.OperationalError: near “?”: syntax error
- Create a main loop with tkinter?
- SyntaxError: Failed to execute ‘evaluate’ on ‘Document’: The string ‘//img[contains(‘1236548597′)]’ is not a valid XPath expression
- What is the fastest and most efficient way to append rows to a DataFrame?
- How to share numpy random state of a parent process with child processes?
- What is a “callable” in Python?
- How can I print multiple things (fixed text and/or variable values) on the same line, all at once?
- Why am I getting “invalid syntax” from an f-string? [duplicate]
- How can I use newline ‘\n’ in an f-string to format output?
- Python decorator? – can someone please explain this? [duplicate]
- Check if rows in one dataframe exist in another dataframe
- A general tree implementation? [closed]
- How to change the voice in pyttsx3?
- How to reuse an expression in a comprehension expression?
- How to move the background image with keys in pygame?