Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def get_lines(filepath):
- """ Reads the contents of filename
- and returns the - File handle
- - List of all lines of the file
- """
- FH = open(filepath, "r+")
- lines = FH.readlines()
- return FH, lines
- def write_lines(new_filename, new_lines):
- """ Writes the lines into the a file whose
- filename is given as argument
- """
- FH = open("C:\\Users\\Ojha\\Documents\\Python exercises\\Python Scripts\\" + new_filename, "w")
- for line in new_lines:
- FH.write(line)
- FH.close()
Add Comment
Please, Sign In to add comment