diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-15 23:04:18 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2016-06-15 23:04:18 +0300 |
commit | a3eb43b2a7e689066133b23eb5615c9d385ad45c (patch) | |
tree | 4f6b2e2b7eab86b12714db59c19c709f7f713eed /mutual_friends.py | |
parent | mutual_friends.py: switch to CSV/JSON output (diff) | |
download | vk-scripts-a3eb43b2a7e689066133b23eb5615c9d385ad45c.tar.gz vk-scripts-a3eb43b2a7e689066133b23eb5615c9d385ad45c.zip |
mutual_friends.py: native newlines in CSV
Diffstat (limited to 'mutual_friends.py')
-rw-r--r-- | mutual_friends.py | 4 |
1 files 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()) |