Computer Science, asked by arifanadeem24, 10 months ago

wap in python to read a text file line by line and display each word separated by #

plzzzzzzzzzzzz don't spam guys

Answers

Answered by thorthunderking
32

Answer:

Sample Solution:-

Python Code: def file_read(fname): with open (fname, "r") as myfile: data=myfile.readlines() print(data) file_read('test.txt') ...

Explanation:

mark as brainlist ....plzz

Answered by SaurabhJacob
3

The python program is,

file = open("Mydoc.txt",'r')

for  line in file:

    word= line.split()

    for w in word:

         print(w + '#',end ='')

    print()

file.close()

  • The open() method is used to open the desired file.
  • 'r' mode is used to open the file in reading mode.
  • After that, the loop is made to run for every line.
  • Another loop is used there to print every word with the '#' symbol.
Similar questions