Skip to content

Instantly share code, notes, and snippets.

@IngIeoAndSpare
Created April 19, 2019 01:02
Show Gist options
  • Save IngIeoAndSpare/d494069238ecb164c6bbce5d2aef31ee to your computer and use it in GitHub Desktop.
Save IngIeoAndSpare/d494069238ecb164c6bbce5d2aef31ee to your computer and use it in GitHub Desktop.
fileRead code
import os
def changeFilePath(file_path):
os.chdir(file_path)
def readFile(file_name) :
file_data = []
file_object = open(file_name, 'r')
while True:
line_value = file_object.readline()
if not line_value:
break
file_data.append(line_value.strip())
return file_data
def readFileHandler(file_name, file_path):
changeFilePath(file_path)
file_content = readFile(file_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment