N
N
Nikolay Baranenko2018-05-11 10:07:38
Python
Nikolay Baranenko, 2018-05-11 10:07:38

What is the correct way to avoid AttributeError: 'NoneType' object has no attribute 'strip' in python 2.7?

Hello.
in the python code for parsing html text, I use everything works fine in the version of the interpreter 3.6, BUT if you switch to 2.7, then the error is reproduced
date_start_job=(data[y].get("Дата")).strip()

date_start_job=(data[y].get("Дата")).strip()
AttributeError: 'NoneType' object has no attribute 'strip'

How to solve this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question