Left: | ||
Right: |
OLD | NEW |
---|---|
(Empty) | |
1 | |
saroyanm
2016/01/22 11:58:14
no need to use short form of the words and abbrevi
saroyanm
2016/01/22 11:58:14
please use "hg rename" when renaming the files, so
juliandoucette
2016/01/25 16:19:55
Done.
juliandoucette
2016/01/25 16:19:55
Done.
| |
2 import random | |
3 from datetime import datetime | |
4 | |
5 def rndsortbydate(value, basedate="1970-01-01", column=0): | |
6 base =datetime.strptime(basedate, "%Y-%m-%d") | |
7 def randdiff(entry): | |
8 date = datetime.strptime(entry[column], "%Y-%m-%d") | |
9 diff = (date - base).days | |
10 return diff * 0.2 + random.randrange(diff) * 0.8 | |
11 return sorted(value, key=randdiff) | |
12 | |
OLD | NEW |