Last active
February 23, 2017 16:22
-
-
Save guestl/1ef9025076276ea886150b2382f32dc8 to your computer and use it in GitHub Desktop.
load file string by string to list (utf-8 compatible)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def load_custom_directories_list_from_file(cdl_filename): | |
if os.path.isfile(cdl_filename): | |
try: | |
with codecs.open(cdl_filename, 'r', 'utf-8') as f: | |
cdl_file_content = f.readlines() | |
# remove special chars like `\n` at the end of each line | |
cdl_file_content = [x.strip() for x in cdl_file_content] | |
return cdl_file_content | |
except Exception as e: | |
logging.error(e) | |
raise e | |
return [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment