G
G
good_lesha82022-03-06 12:15:40
Python
good_lesha8, 2022-03-06 12:15:40

How to bring a table into a certain form (python)?

Hello! I parse the page and get this data format.

18.
17.
Arsenal
22
11
11
34:25
2.7
?
-
-
+
+
+
18.
Burnley
21
8
13
17:29
2.2
?
-
-
-
-
+
19.
Brighton
23
5
18
25:23
2.1
?
-
-
-
-
+
20.
Wolves
23
5
18
21:17
1.7
?
-
-
+
+
-
If the teams score the same number of points, then the places in the table will be determined by the goal difference.


what python methods can be used to convert data to the format:

Arsenal - - + + +
Burnley - - - - +
Brighton - - - - +
Wolves - - + + -

so that later it would be possible to leave only those commands that have "-" more than three?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
soremix, 2022-03-06
@good_lesha8

какими методами python можно воспользоваться, чтобы привести данные к формату:

Loop for, comparison if, output print, well, a method isalpha()to understand where the line is.
Loop through all the lines, if the line consists of letters - print it, if the line contains + or - - print these characters

K
Kvason, 2022-03-06
@Kvason

Well, for starters, the question is where you are parsing from, and how the necessary blocks are formed there, it seems that you are parsing the contents of just these blocks, then you can get blocks with minuses from each record and concatenate with the name of the command, and not display them separately

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question