Created
May 1, 2016 06:05
-
-
Save maithreyee/f18dcf4dbd5bf4e5ee39368d34784470 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
import csv | |
def getPendingProfile(name): | |
myList = [] | |
with open('Sheet1.csv', 'rb') as fo: | |
spamreader = csv.DictReader(fo) | |
for each in spamreader: | |
if each['Owner'] == name and each['Done?'] != 'x': | |
myList.append(each['Profile Page']) | |
return len(myList) | |
def makeDone(): | |
with open('Sheet2.csv', 'w') as fo: | |
names = ['Profile Page', 'DOne?'] | |
spamreader = csv.DictWriter(fo, fieldnames=names) | |
spamreader.writeheader() | |
spamreader.writerow({'Profile Page': 'MAsmsa', 'DOne?': 'x'}) | |
spamreader.writerow({'Profile Page': 'MAsdsdmsamsa', 'DOne?': 'x'}) | |
spamreader.writerow({'Profile Page': 'ddsd', 'DOne?': 'y'}) | |
spamreader.writerow({'Profile Page': 'dsdsd', 'DOne?': 'x'}) | |
def newFile(): | |
with open('Sheet1.csv', 'r') as fo: | |
myData = csv.DictReader(fo) | |
with open('Sheet3.csv', 'w') as new: | |
names = ['Profile Page', 'Done?'] | |
writer = csv.DictWriter(new, fieldnames=names) | |
writer.writeheader() | |
for each in myData: | |
if each['Done?'] != 'x': | |
writer.writerow({'Profile Page': each['Profile Page'], 'Done?': each['Done?']}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment