As noted, spam = spam + 1
increases the value of spam
by one.
That makes more sense if the program you are looking at is actually this:
spam = 0
while spam < 5:
print('Hello, world.')
spam = spam + 1
Now the spam = spam + 1
is part of the loop body ... and whole program is going to print "Hello, world" 5 times.
Indentation is significant to the meaning of a program in Python.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…