Created
February 10, 2020 06:37
-
-
Save Jongbhin/411ea4baa6bc0d725a282f538c1b16ca to your computer and use it in GitHub Desktop.
[make dict for key value] #dict, #python, #pickle
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
with open(input_file) as ifd: | |
csv_reader = csv.reader(ifd, delimiter='\t', quoting=csv.QUOTE_NONE) | |
token_dict = {} | |
for counter, row in enumerate(csv_reader): | |
prd_no = row[0] | |
token_dict[prd_no] = row[1:] | |
with open(output_file, mode='w') as wfd: | |
pickle.dump(token_dict, wfd, protocol=pickle.HIGHEST_PROTOCOL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment