forked from avraampiperidis/imdb_pyscraper
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitidarray.py
More file actions
70 lines (59 loc) · 1.84 KB
/
initidarray.py
File metadata and controls
70 lines (59 loc) · 1.84 KB
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
from conf import imdb_id_start_from
from conf import imdb_id_stop_in
def initidarray():
temparr = []
idarr = []
print 'init id array...!this might take some time if the gap is big'
start = imdb_id_start_from
stop = imdb_id_stop_in
for i in xrange(imdb_id_start_from,imdb_id_stop_in):
temparr.append(start)
start += 1
if start == stop:
temparr.append(start)
for x in temparr:
numstr = str(x)
if len(numstr) == 1:
id = '000000'+`x`
idarr.append(id)
if len(numstr) == 2:
id = '00000'+`x`
idarr.append(id)
if len(numstr) == 3:
id = '0000'+`x`
idarr.append(id)
if len(numstr) == 4:
id = '000'+`x`
idarr.append(id)
if len(numstr) == 5:
id = '00'+`x`
idarr.append(id)
if len(numstr) == 6:
id = '0'+`x`
idarr.append(id)
if len(numstr) == 7:
id = ''+`x`
idarr.append(id)
return idarr
#!deprecated!
def initidarr():
idarr = []
print '|-->Initializing array...'
for i in xrange(0,9999999):
if i < 10:
idarr.append('000000'+`i`)
if i >= 10 and i <= 99:
idarr.append('00000'+`i`)
if i >= 100 and i <= 999:
idarr.append('0000'+`i`)
if i >= 4900 and i <= 9999:
idarr.append('000'+`i`)
if i >= 68475 and i <= 99999:
idarr.append('00'+`i`)
if i >= 100000 and i <= 999999:
idarr.append('0'+`i`)
if i >= 1000000 and i <= 9999999:
idarr.append(i)
if i == imdb_id_stop_in+2:
return idarr
print i