How to remove nonAscii characters in python

后端 未结 3 931
梦如初夏
梦如初夏 2020-12-22 01:00

This is my code:

#!C:/Python27/python
# -*- coding: utf-8 -*-
import requests
from bs4 import BeautifulSoup
import urllib2
import sys
import urlparse
import          


        
3条回答
  •  执念已碎
    2020-12-22 01:38

    To remove non ASCII characters from text.

    import string
    
    text = [word for word in text if word not in string.ascii_letters]
    

提交回复
热议问题