From a3eb43b2a7e689066133b23eb5615c9d385ad45c Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 15 Jun 2016 23:04:18 +0300 Subject: mutual_friends.py: native newlines in CSV --- mutual_friends.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mutual_friends.py b/mutual_friends.py index 3b86a8e..7df408a 100644 --- a/mutual_friends.py +++ b/mutual_friends.py @@ -14,7 +14,7 @@ from vk.user import Field def query_friend_list(api, user): return api.friends_get(user.get_uid(), fields=Field.SCREEN_NAME) -OUTPUT_FIELDS = Field.FIRST_NAME, Field.LAST_NAME, Field.SCREEN_NAME +OUTPUT_FIELDS = Field.UID, Field.FIRST_NAME, Field.LAST_NAME, Field.SCREEN_NAME def extract_output_fields(user): new_user = OrderedDict() @@ -23,7 +23,7 @@ def extract_output_fields(user): return new_user def print_mutual_friends_csv(mutual_friends): - writer = csv.writer(sys.stdout) + writer = csv.writer(sys.stdout, lineterminator='\n') for user in mutual_friends: user = extract_output_fields(user) writer.writerow(user.values()) -- cgit v1.2.3