I am new to python and I would like to print different words from the sentence. Below is the text file
Test.txt
1. As more than one social media historian has reminded few people, the Stonewall uprising was a rio-— more pointedly, a riot against police brutality, in response to an NYPD raid of Greenwich Village’s
Stonewall Inn, in the early morning of June 29, 1969.
2. As more than one social media historian has reminded majority people, the Stonewall uprising was a riot — more pointedly, a riot against police brutality, in response to an NYPD raid of Greenwich Village’s Stonewall Inn, in the evening of July 12, 1979.
From the above text file, I want 10th word(few), 11th word(people), 39th word(morning), 43rd word (1969), from the first line. And for the second line also 10th word(majority), 11th word (people), 39th word (evening), 43rd (1979).
Note: In the Test.txt 1. means line one and 2. means line 2
For this, I tried using the split function.
with open('Test.txt', 'r') as file:
for line in file:
print (line.split('reminded',1)[1])
This is the output that I got
few people, the Stonewall uprising was a riot - more pointedly, a riot against police brutality, in response to an NYPD raid of Greenwich Villagers Stonewall Inn, in the early morning of June 29, 1969.
majority people, the Stonewall uprising was a riot — more pointedly, a riot against police brutality, in response to an NYPD raid of Greenwich Village’s Stonewall Inn, in the evening of July 12, 1979.
How do I print only one word after using split function? I am pretty that I still need to improve this code.
Any help would be appreciated. Thanks in advance.