Python reads consecutive numbers

there is a column of numbers in my file, which looks like:

1
2
7
8
9
12
17
21
22
23

I want to get three consecutive numbers and output them. For example, in the above file, the result I want to get is

.
7
8
9

I would like to ask you, how should it be realized? Thank you

Mar.16,2021

first read all the data into a list, and then go through it.
for i in range (2, len (nums)):

  if nums[i] + nums[i -2] == nums[i-1] * 2:
      print()

you can also make this judgment while reading the file

it is not convenient for typing on mobile phone. The format may not be correct


read one line at a time, dynamically plan something at will, or draw a state transition picture to realize it. If you think about this topic for yourself, you will know


similar problem, understand?

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3238d-2be00.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3238d-2be00.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?