What should return doc.ents if the doc have no entities, in spacy?
You could just test whether the tuples entities has any elements:

for sent in list(doc.sents):
    if len(sent.ents) &gt; 0:
        nb = nb+1


Edit: For the purpose of evaluating boolean expressions (as in case of if statements), empty lists are evaluated as false, even though they don't explicitly equal False. Expanding your example with some print statements:

nb = 0
spacy_nlp = spacy.load("de_core_news_md")
text = "Nichts. Auch nichts."
doc = spacy_nlp(text)
for sent in list(doc.sents):
    print("type of ents: " + str(type(sent.ents)) + " with " + str(len(sent.ents)) + " elements.")
    if sent.ents:
        nb = nb+1

print(nb)


Results in:

type of ents: &lt;class 'list'&gt; with 0 elements.
type of ents: &lt;class 'list'&gt; with 0 elements.
0