Computer Science, asked by harshice361, 1 month ago

Write a function to read a text file stoy.txt and display only those words which are starting with letter ‘a’.​

Answers

Answered by kiranansh1988
0

Answer:

Write a function to read a text file stoy.txt and display only those words which are starting with letter ‘a’.

Explanation:

Write a function to read a text file stoy.txt and display only those words which are starting with letter ‘a’.

Answered by ganiealtafqwe
0

Answer:

Entire text file 2. 1st lines of the text file. 3. m lines starting from the nth line 4. number of words in each line with open("FilemultiLines.txt") as f : print('Entire Content of File is :: \n') print(f.read().strip()) f.seek(0) print('\n 1st n Line of Text File :: \n') print(f.readline().strip()) f.seek(0) m = int(input("\nenter line no. from where you want to start : ")) n = int(input("enter line no. upto where you want to end : ")) print("\nm lines starting from the nth line :: \n") for i in (f.readlines() [m-1:n]) : print(i,end = '' ) print('\n') print('number of words in each line : \n') f.seek(0) for i in f.readlines() : words = len(i.split(' ')) print('Line ',i,' is :: ',words)Read more on Sarthaks.com - https://www.sarthaks.com/505019/write-method-function-displaywords-python-lines-text-story-display-those-words-which-less

Similar questions