Created
September 25, 2019 10:09
-
-
Save dewanshrawat15/0e34b76b1d1c4eda5aa2677e4b9c3f11 to your computer and use it in GitHub Desktop.
Python script to extract participant details for sorting different participants according to domain of interest.
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
import csv | |
names = [] | |
emails = [] | |
phoneNumbers = [] | |
year = [] | |
department = [] | |
teamInterested = [] | |
with open("data.csv", "r") as file: | |
row = csv.DictReader(file) | |
for line in row: | |
names.append(line["name"]) | |
emails.append(line["email"]) | |
phoneNumbers.append(line["phoneNumber"]) | |
year.append(line["year"]) | |
department.append(line["department"]) | |
teamInterested.append(line["teamInterested"]) | |
roles = ["technical", "designing", "media", "management"] | |
technical = [] | |
designing = [] | |
media = [] | |
management = [] | |
for i in range(len(names)): | |
if "Technical" in teamInterested[i]: | |
technical.append(i) | |
if "Designing" in teamInterested[i]: | |
designing.append(i) | |
if "Media" in teamInterested[i]: | |
media.append(i) | |
if "Management" in teamInterested[i]: | |
management.append(i) | |
for i in technical: | |
row = [] | |
row.append(names[i]) | |
row.append(emails[i]) | |
row.append(phoneNumbers[i]) | |
row.append(year[i]) | |
row.append(department[i]) | |
with open("technical.csv", "a") as data: | |
writer = csv.writer(data) | |
writer.writerow(row) | |
for i in designing: | |
row = [] | |
row.append(names[i]) | |
row.append(emails[i]) | |
row.append(phoneNumbers[i]) | |
row.append(year[i]) | |
row.append(department[i]) | |
with open("designing.csv", "a") as data: | |
writer = csv.writer(data) | |
writer.writerow(row) | |
for i in media: | |
row = [] | |
row.append(names[i]) | |
row.append(emails[i]) | |
row.append(phoneNumbers[i]) | |
row.append(year[i]) | |
row.append(department[i]) | |
with open("media.csv", "a") as data: | |
writer = csv.writer(data) | |
writer.writerow(row) | |
for i in management: | |
row = [] | |
row.append(names[i]) | |
row.append(emails[i]) | |
row.append(phoneNumbers[i]) | |
row.append(year[i]) | |
row.append(department[i]) | |
with open("management.csv", "a") as data: | |
writer = csv.writer(data) | |
writer.writerow(row) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just add different if statements for more teams and more loops for the respective teams with different csv files.
We used the same script while recruiting people at @dscbvppune