Created
August 27, 2014 10:34
-
-
Save jorge-lavin/f1210c459a9e68dd0bae to your computer and use it in GitHub Desktop.
This file contains 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 file_to_string(file_path): | |
""" | |
Converts a file into a string. \\t\\n join is used for format purposes in Outlook | |
""" | |
with open(file_path) as file_: | |
reader = csv.reader(file_, delimiter=';') | |
#If no delimiter is specified and are commas, ;, or other csv reader delimiters, this function may not | |
#work as expected. Therefore we force it to have ; because are not likely to be present | |
line = [] | |
for lines in reader: | |
line.append(lines[0]) | |
return '\t\n'.join(line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment