-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselector.py
More file actions
29 lines (26 loc) · 835 Bytes
/
selector.py
File metadata and controls
29 lines (26 loc) · 835 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#-------------------------------------------------------------------------------
# Name: module1
# Purpose:
#
# Author: William
#
# Created: 03/10/2013
# Copyright: (c) William 2013
# Licence: <your licence>
#-------------------------------------------------------------------------------
import random
from itertools import chain
import numpy as np
import os
p = "../images/li_photograph/image.cd/"
k = filter(lambda a: a != "Thumbs.db", (os.listdir(p + "1/") + os.listdir(p + "2/") + os.listdir(p + "3/") + os.listdir(p + "4/") + os.listdir(p + "5/")))
def select(n):
if n > 0:
l = [i.rstrip(".jpg") for i in random.sample(k,n)]
else:
l = [i.rstrip(".jpg") for i in k]
return l
def main():
print select(30,2)
if __name__ == '__main__':
main()