# Read in the file with open('lista.txt', 'r') as file: filedata = file.read() # Replace the target string filedata = filedata.replace('Verona', 'Hellas Verona') # Write the file out again with open('fileok.txt', 'w') as file: file.write(filedata)i have a txt with some text in this structure
Output:Verona - Napoli
10.42% (9.60) 1.11% 1
27.08% (3.69) 11.11% X
62.5% (1.60) -11.11% 2
37.5% (2.67) 11.11% 1X
89.58% (1.12) -1.11% X2
72.92% (1.37) -11.11% 12
Torino - Inter
15.38% (6.50) 1.11% 1
23.08% (4.33) 1.1% X
61.54% (1.62) -11.11% 2
38.46% (2.60) 11.11% 1X
84.62% (1.18) -1.11% X2
76.92% (1.30) -1.1% 12
Sassuolo - Lazio
24.07% (4.15) 11.11% 1
29.63% (3.37) -11.11% X
46.3% (2.16) 1.11% 2
53.7% (1.86) -1.11% 1X
75.93% (1.32) -11.11% X2
70.37% (1.42) 11.11% 12
AS Roma - Monza
57.58% (1.74) 1
33.33% (3.00) X
9.09% (11.00) 2
90.91% (1.10) 1X
42.42% (2.36) X2
66.67% (1.50) 12
Bologna - Frosinone
52.38% (1.91) -1.11% 1
29.37% (3.40) 1.1% X
18.25% (5.48) 1.11% 2
81.75% (1.22) -1.11% 1X
47.62% (2.10) 1.11% X2
70.63% (1.42) -1.1% 12
Salernitana - Cagliari
37.78% (2.65) 11.11% 1
28.89% (3.46) -1.11% X
33.33% (3.00) -1.11% 2
66.67% (1.50) 1.11% 1X
62.22% (1.61) -11.11% X2
71.11% (1.41) 1.11% 12
Atalanta - Genoa
72.3% (1.38) 11.11% 1
17.57% (5.69) -11.11% X
10.14% (9.86) 1.11% 2
89.86% (1.11) -1.11% 1X
27.7% (3.61) -11.11% X2
82.43% (1.21) 11.11% 12
AC Milan - Juventus
43.35% (2.31) -11.1% 1
30.64% (3.26) 11.11% X
26.01% (3.84) -1.11% 2
73.99% (1.35) 1.11% 1X
56.65% (1.77) 11.1% X2
69.36% (1.44) -11.11% 12
Udinese - Lecce
44.1% (2.27) 11.11% 1
32.75% (3.05) -11.1% X
23.14% (4.32) 1.11% 2
76.86% (1.30) -1.11% 1X
55.9% (1.79) -11.11% X2
67.25% (1.49) 11.1% 12
Fiorentina - Empoli
68.59% (1.46) -11.11% 1
19.87% (5.03) 11.11% X
11.54% (8.67) 1.11% 2
88.46% (1.13) -1.11% 1X
31.41% (3.18) 11.11% X2
80.13% (1.25) -11.11% 12
Genoa - Salernitana
54.55% (1.83) 11.11% 1
25.97% (3.85) -11.11% X
19.48% (5.13) 11.11% 2
80.52% (1.24) -11.11% 1X
45.45% (2.20) -11.11% X2
74.03% (1.35) 11.11% 12
Sassuolo - Bologna
45.39% (2.20) -1.11% 1
26.95% (3.71) 1.11% X
27.66% (3.62) -1.1% 2
72.34% (1.38) 1.1% 1X
54.61% (1.83) 1.11% X2
73.05% (1.37) -1.11% 12
Lecce - Torino
33.96% (2.94) 11.11% 1
26.42% (3.79) -1.11% X
39.62% (2.52) -1.11% 2
60.38% (1.66) 1.11% 1X
66.04% (1.51) -11.11% X2
73.58% (1.36) 1.11% 12
Juventus - Verona
67.94% (1.47) 1.1% 1
22.14% (4.52) -1.11% X
9.92% (10.08) 1.11% 2
90.08% (1.11) -1.11% 1X
32.06% (3.12) -1.1% X2
77.86% (1.28) 1.11% 12
Cagliari - Frosinone
28.57% (3.50) 1
23.81% (4.20) X
47.62% (2.10) 2
52.38% (1.91) 1X
71.43% (1.40) X2
76.19% (1.31) 12
Monza - Udinese
37.04% (2.70) 11.11% 1
35.8% (2.79) 11.11% X
27.16% (3.68) -11.11% 2
72.84% (1.37) 11.11% 1X
62.96% (1.59) -11.11% X2
64.2% (1.56) -11.11% 12
Inter - AS Roma
55.1% (1.81) 1.11% 1
26.53% (3.77) -1.11% X
18.37% (5.44) -1.1% 2
81.63% (1.23) 1.1% 1X
44.9% (2.23) -1.11% X2
73.47% (1.36) 1.11% 12
Napoli - AC Milan
38.57% (2.59) 11.1% 1
40% (2.50) -11.11% X
21.43% (4.67) 1.11% 2
78.57% (1.27) -1.11% 1X
61.43% (1.63) -11.1% X2
60% (1.67) 11.11% 12
Empoli - Atalanta
25% (4.00) 1
37.5% (2.67) X
37.5% (2.67) 2
62.5% (1.60) 1X
75% (1.33) X2
62.5% (1.60) 12
Lazio - Fiorentina
41% (2.44) 1.11% 1
26.5% (3.77) -11.11% X
32.5% (3.08) 11.11% 2
67.5% (1.48) -11.11% 1X
59% (1.69) -1.11% X2
73.5% (1.36) 11.11% 12
Verona - Napoli
10.42% (9.60) 1.11% 1
27.08% (3.69) 11.11% X
62.5% (1.60) -11.11% 2
37.5% (2.67) 11.11% 1X
89.58% (1.12) -1.11% X2
72.92% (1.37) -11.11% 12
Torino - Inter
15.38% (6.50) 1.11% 1
23.08% (4.33) 1.1% X
61.54% (1.62) -11.11% 2
38.46% (2.60) 11.11% 1X
84.62% (1.18) -1.11% X2
76.92% (1.30) -1.1% 12
Sassuolo - Lazio
24.07% (4.15) 11.11% 1
29.63% (3.37) -11.11% X
46.3% (2.16) 1.11% 2
53.7% (1.86) -1.11% 1X
75.93% (1.32) -11.11% X2
70.37% (1.42) 11.11% 12
AS Roma - Monza
57.58% (1.74) 1
33.33% (3.00) X
9.09% (11.00) 2
90.91% (1.10) 1X
42.42% (2.36) X2
66.67% (1.50) 12
Bologna - Frosinone
52.38% (1.91) -1.11% 1
29.37% (3.40) 1.1% X
18.25% (5.48) 1.11% 2
81.75% (1.22) -1.11% 1X
47.62% (2.10) 1.11% X2
70.63% (1.42) -1.1% 12
Salernitana - Cagliari
37.78% (2.65) 11.11% 1
28.89% (3.46) -1.11% X
33.33% (3.00) -1.11% 2
66.67% (1.50) 1.11% 1X
62.22% (1.61) -11.11% X2
71.11% (1.41) 1.11% 12
Atalanta - Genoa
72.3% (1.38) 11.11% 1
17.57% (5.69) -11.11% X
10.14% (9.86) 1.11% 2
89.86% (1.11) -1.11% 1X
27.7% (3.61) -11.11% X2
82.43% (1.21) 11.11% 12
AC Milan - Juventus
43.35% (2.31) -11.1% 1
30.64% (3.26) 11.11% X
26.01% (3.84) -1.11% 2
73.99% (1.35) 1.11% 1X
56.65% (1.77) 11.1% X2
69.36% (1.44) -11.11% 12
Udinese - Lecce
44.1% (2.27) 11.11% 1
32.75% (3.05) -11.1% X
23.14% (4.32) 1.11% 2
76.86% (1.30) -1.11% 1X
55.9% (1.79) -11.11% X2
67.25% (1.49) 11.1% 12
Fiorentina - Empoli
68.59% (1.46) -11.11% 1
19.87% (5.03) 11.11% X
11.54% (8.67) 1.11% 2
88.46% (1.13) -1.11% 1X
31.41% (3.18) 11.11% X2
80.13% (1.25) -11.11% 12
Genoa - Salernitana
54.55% (1.83) 11.11% 1
25.97% (3.85) -11.11% X
19.48% (5.13) 11.11% 2
80.52% (1.24) -11.11% 1X
45.45% (2.20) -11.11% X2
74.03% (1.35) 11.11% 12
Sassuolo - Bologna
45.39% (2.20) -1.11% 1
26.95% (3.71) 1.11% X
27.66% (3.62) -1.1% 2
72.34% (1.38) 1.1% 1X
54.61% (1.83) 1.11% X2
73.05% (1.37) -1.11% 12
Lecce - Torino
33.96% (2.94) 11.11% 1
26.42% (3.79) -1.11% X
39.62% (2.52) -1.11% 2
60.38% (1.66) 1.11% 1X
66.04% (1.51) -11.11% X2
73.58% (1.36) 1.11% 12
Juventus - Verona
67.94% (1.47) 1.1% 1
22.14% (4.52) -1.11% X
9.92% (10.08) 1.11% 2
90.08% (1.11) -1.11% 1X
32.06% (3.12) -1.1% X2
77.86% (1.28) 1.11% 12
Cagliari - Frosinone
28.57% (3.50) 1
23.81% (4.20) X
47.62% (2.10) 2
52.38% (1.91) 1X
71.43% (1.40) X2
76.19% (1.31) 12
Monza - Udinese
37.04% (2.70) 11.11% 1
35.8% (2.79) 11.11% X
27.16% (3.68) -11.11% 2
72.84% (1.37) 11.11% 1X
62.96% (1.59) -11.11% X2
64.2% (1.56) -11.11% 12
Inter - AS Roma
55.1% (1.81) 1.11% 1
26.53% (3.77) -1.11% X
18.37% (5.44) -1.1% 2
81.63% (1.23) 1.1% 1X
44.9% (2.23) -1.11% X2
73.47% (1.36) 1.11% 12
Napoli - AC Milan
38.57% (2.59) 11.1% 1
40% (2.50) -11.11% X
21.43% (4.67) 1.11% 2
78.57% (1.27) -1.11% 1X
61.43% (1.63) -11.1% X2
60% (1.67) 11.11% 12
Empoli - Atalanta
25% (4.00) 1
37.5% (2.67) X
37.5% (2.67) 2
62.5% (1.60) 1X
75% (1.33) X2
62.5% (1.60) 12
Lazio - Fiorentina
41% (2.44) 1.11% 1
26.5% (3.77) -11.11% X
32.5% (3.08) 11.11% 2
67.5% (1.48) -11.11% 1X
59% (1.69) -1.11% X2
73.5% (1.36) 11.11% 12
is it possible to replace all text inside it? and not for only one?Verona -> Hellas Verona
Sassuolo -> Sassuolo Calcio
Monza -> Ac Monza
and remove all 11.11% and -1.11%