python looping through input file

后端 未结 4 1355
抹茶落季
抹茶落季 2020-12-16 15:07

My question is related to file-input in Python, using open(). I have a text file mytext.txt with 3 lines. I am trying to do two things with this fi

4条回答
  •  时光取名叫无心
    2020-12-16 15:13

    Try adding a input_file.seek(0) between the two loops. This will rewind the file back to the beginning, so you can loop over it again.

提交回复
热议问题