Learn Python the Hard Way Ex.41 Confused About For loop

后端 未结 2 1586
广开言路
广开言路 2020-12-21 16:46

I am having trouble understanding how one of the for loops works in Learn Python the Hard Way ex.41. http://learnpythonthehardway.org/book/ex41.html Below is the code from t

2条回答
  •  青春惊慌失措
    2020-12-21 17:41

    snippet.count("@@@") returns the number of times "@@@" appears in snippet.

    If "@@@" appears 6 times, then the for-loop iterates from 0 to 6.

提交回复
热议问题