Advertisement
homeworkhelp111

readline

Nov 28th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. def main():
  2.     fileName = input('Enter the name of the file: ')
  3.     infile = open(fileName,'r')
  4.     line = infile.readline()
  5.     counter = 1
  6.     while(line and counter <=5):
  7.         print(line, end='')
  8.         line = infile.readline()
  9.         counter += 1
  10.     infile.close()
  11.  
  12. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement