If you know for sure that is the only character you don’t want, you can .replace
it:
>>> word.replace(u'\xa0', ' ') u'Buffalo, IL 60625'
If you need to handle all non-ascii characters, encoding and replacing bad characters might be a good start…:
>>> word.encode('ascii', 'replace') 'Buffalo,?IL?60625'
Related Posts:
- u’\ufeff’ in Python string
- python encoding utf-8
- How to resolve TypeError: can only concatenate str (not “int”) to str [duplicate]
- How to correct TypeError: Unicode-objects must be encoded before hashing?
- How to remove \xa0 from string in Python?
- What’s the difference between ASCII and Unicode?
- What does the ‘b’ character do in front of a string literal?
- What does the ‘b’ character do in front of a string literal?
- (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape
- Using awk to remove the Byte-order mark
- (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: truncated \UXXXXXXXX escape
- What’s up with these Unicode combining characters and how can we filter them?
- Unicode range for Japanese
- “Unicode Error “unicodeescape” codec can’t decode bytes… Cannot open text files in Python 3
- Python – ‘ascii’ codec can’t decode byte
- UnicodeEncodeError: ‘ascii’ codec can’t encode character u’\xa0′ in position 20: ordinal not in range(128)
- Python string prints as [u’String’]
- NameError: global name ‘unicode’ is not defined – in Python 3
- Convert a Unicode string to a string in Python (containing extra symbols)python string unicode type-conversion
- Using unicode character u201c
- What is a unicode string?
- What Unicode characters represent “time”?
- Convert Unicode to ASCII without errors in Python
- TypeError: coercing to Unicode: need string or buffer, int found
- UnicodeDecodeError, invalid continuation byte
- What exactly do “u” and “r” string flags do, and what are raw string literals?
- What’s the difference between UTF-8 and UTF-8 without BOM?
- How to write unicode strings into a file?
- List of all unicode’s open/close brackets?
- Japanese ASCII Code
- How to read a file line-by-line into a list?
- What exactly does += do in python?
- How do I sort a dictionary by value?
- Understanding Python super() with __init__() methods [duplicate]
- Relative imports – ModuleNotFoundError: No module named x
- Using global variables in a function
- How do I upgrade the Python installation in Windows 10?
- Selecting multiple columns in a Pandas dataframe
- Python Variable Declaration
- How can I remove a key from a Python dictionary?
- What does numpy.random.seed(0) do?
- How to uninstall Python 2.7 on a Mac OS X 10.6.4?
- Python: maximum recursion depth exceeded while calling a Python object
- How do I check if a variable exists?
- Is there a label/goto in Python?
- Why do I get “Pickle – EOFError: Ran out of input” reading an empty file?
- Getting TypeError: __init__() missing 1 required positional argument: ‘on_delete’ when trying to add parent table after child table with entries
- Python Pandas Counting the Occurrences of a Specific value
- python re.split() to split by spaces, commas, and periods, but not in cases like 1,000 or 1.50
- How can I write a `try`/`except` block that catches all exceptions?
- What does the c underscore expression `c_` do exactly?
- Count unique values per groups with Pandas
- Get unique values from a list in python [duplicate]
- How do you decode Base64 data in Python?
- Convert pandas Series to DataFrame
- How to get element-wise matrix multiplication (Hadamard product) in numpy?
- Matplotlib automatic legend outside plot
- Why am I getting this syntax error: keyword can’t be an expression
- What version of Python is on my Mac?
- Django: ImproperlyConfigured: The SECRET_KEY setting must not be empty
- What is dtype(‘O’), in pandas?
- ctypes – Beginner
- Keras, how do I predict after I trained a model?
- How do I find out my PYTHONPATH using Python?
- ValueError: could not broadcast input array from shape (224,224,3) into shape (224,224)
- Overflow Error in Python’s numpy.exp function
- Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock
- Can’t broadcast input array from shape (3,1) into shape (3,)
- How to create an array of bits in Python?
- Setting Django up to use MySQL
- In Python, when to use a Dictionary, List or Set?
- How can I check for NaN values?
- Python – how to use the constant e^
- Check if two unordered lists are equal
- Is there a list of Pytz Timezones?
- Flask example with POST
- How do I change the figure size with subplots?
- Clear terminal in Python [duplicate]
- ImportError: No module named six
- Easy pretty printing of floats?
- Unable to convert 3d ply file image to 2d image
- Algorithm for solving Sudoku
- How to read pickle file?
- Running a Python script from PHP
- Python Socket Receive Large Amount of Data
- Py_Initialize fails – unable to load the file system codec
- What is a “slug” in Django?
- Simple way to create matrix of random numbers
- pandas: multiple conditions while indexing data frame – unexpected behavior
- ‘instancemethod’ object has no attribute ‘__getitem__’ with class variables
- Python/Scikit-Learn – Can’t handle mix of multiclass and continuous
- Sorting list of lists by the first element of each sub-list
- Equivalent to matlab’s imagesc in matplotlib? [duplicate]
- bash: syntax error near unexpected token `(‘ – Python
- Find all files in a directory with extension .txt in Python
- “public” or “private” attribute in Python ? What is the best way?
- How to search for a string in text files?
- TypeError: ‘zip’ object is not subscriptable
- Pip: could not find a version. No matching distribution found
- How do you fetch the authors email or IP from /comments? (REST API)