Home > other >  Rookie consult about read TXT documents, and counting
Rookie consult about read TXT documents, and counting

Time:05-15

[11:06:33. 868] please receive + Recv Success
+ DownCounter: 990
+ Port: 1
+ Rssi: - 54
+ Data: 31 32 33 34 35 36, 37, 38, 39, 30, 31 32 33 34 35 36
37, 38, 39, 30, 31 32 33 34 35 36, 37, 38, 39, 30, 31 and 32
33, 34, 35, 36 37 and 39 30 31 32 33 34 35 36 37, 38
39 30 31

[11:06:38. 884] please receive + Recv Success
+ DownCounter: 991
+ Port: 1
43
+ Rssi: -+ Data: 31 32 33 34 35 36, 37, 38, 39, 30, 31 32 33 34 35 36
37, 38, 39, 30, 31 32 33 34 35 36, 37, 38, 39, 30, 31 and 32
33, 34, 35, 36 37 and 39 30 31 32 33 34 35 36 37, 38
39 30 31

[11:06:43. 894] please receive + Recv Success
+ DownCounter: 992
+ Port: 1
+ Rssi: - 38
+ Data: 31 32 33 34 35 36, 37, 38, 39, 30, 31 32 33 34 35 36
37, 38, 39, 30, 31 32 33 34 35 36, 37, 38, 39, 30, 31 and 32
33, 34, 35, 36 37 and 39 30 31 32 33 34 35 36 37, 38
39 30 31

[11:06:48. 905] please receive + Recv Success
+ DownCounter: 993
+ Port: 1
48
+ Rssi: -+ Data: 31 32 33 34 35 36, 37, 38, 39, 30, 31 32 33 34 35 36
37, 38, 39, 30, 31 32 33 34 35 36, 37, 38, 39, 30, 31 and 32
33, 34, 35, 36 37 and 39 30 31 32 33 34 35 36 37, 38
39 30 31

[11:06:53. 928] please receive + Recv Success
+ DownCounter: 994
+ Port: 1
+ Rssi: - 54
+ Data: 31 32 33 34 35 36, 37, 38, 39, 30, 31 32 33 34 35 36
37, 38, 39, 30, 31 32 33 34 35 36, 37, 38, 39, 30, 31 and 32
33, 34, 35, 36 37 and 39 30 31 32 33 34 35 36 37, 38
39 30 31

Data shown above, I think statistics + DownCounter: the number of 994, lost which packages than look at the middle

CodePudding user response:

 import re 

With the open (r "test. TXT") as f:
Con=f.r ead ()
Res=re. The.findall (r "\ + DownCounter: (\ d *)", con, re. DOTALL)
Print (res)

CodePudding user response:

reference 1st floor chuifengde response:
 import re 

With the open (r "test. TXT") as f:
Con=f.r ead ()
Res=re. The.findall (r "\ + DownCounter: (\ d *)", con, re. DOTALL)
Print (res)

You can comment the first 5 lines again
  • Related