Created
November 20, 2014 03:32
-
-
Save kyu999/8cf2da9de11d53baba0a to your computer and use it in GitHub Desktop.
backup
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
""" | |
def swap_iterate(self, cursor): | |
if(not cursor.alive): | |
return "Finish" | |
data = cursor.next() | |
swapped_date = self.swap_date(data.get("date")) | |
data["date"] = swapped_date | |
self.coll.save(data) | |
return self.swap_iterate(cursor) | |
def swap_all_date(self): | |
return self.swap_iterate(self.coll.find()) | |
""" | |
""" | |
def replace_today(self): | |
cursor = self.coll.find({"date" : "Today"}) | |
while(cursor.alive): | |
manga = cursor.next() | |
manga["date"] = "2014-11-18" | |
self.coll.save(manga) | |
""" | |
def to_int_views(self, start, end): | |
cursor = self.coll.find()[start:end] | |
while(cursor.alive): | |
try: | |
content = cursor.next() | |
str_views = content["views"] | |
int_views = int(str_views) | |
content["views"] = int(str_views) | |
print(int_views) | |
self.coll.save(content) | |
except: | |
print("cannot convert to int") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment