Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

scraped text in Russian encoding python

from bs4 import BeautifulSoup
import requests

source = requests.get('https://time.mk/')  # don't convert to text just yet

# print(source.encoding)
# prints out ISO-8859-1

source.encoding = 'utf-8'  # override encoding manually

soup = BeautifulSoup(source.text, 'lxml')  # this will now decode utf-8 correctly
Comment

PREVIOUS NEXT
Code Example
Python :: how to make a timer in pyothn 
Python :: sklearn standardscaler for numerical columns 
Python :: odoo 8 request.session.authenticate 
Python :: disable kivy button in kv 
Python :: python break string to sections 
Python :: python as integer ratio 
Python :: how to hide a specific file in python 
Python :: Generate bootstrap replicate of 1D data that return a particular operation on a range 
Python :: string letters only 
Python :: cv2 jupyter notebook matplotlib inverted colors fix 
Python :: convert depth image to point cloud 
Python :: Preprocessing of transfer learning inception v3 
Python :: print two values using f string 
Python :: access dictionary in f string 
Python :: Creating a bag-of-words in scikit-learn 
Python :: how to print continuesly in the same line in python 
Python :: base64 encode image in python 
Python :: for con condicion 
Python :: egt id of current object django 
Python :: Horizontal concatication 
Python :: python code optimization 
Python :: pandas fast way to view distribution by group 
Python :: get_string python 
Python :: python packing circles 
Python :: django model meta ordering multiple ordering 
Python :: discord.py cog classes 
Python :: csv logger keras 
Python :: extrapolate python 
Python :: py - count if a word is present in a column 
Python :: visualizzare csv in pycharm pandas read_csv 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =