-
Notifications
You must be signed in to change notification settings - Fork 0
/
history
112 lines (112 loc) · 2.57 KB
/
history
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import deap
clear
import deap
deap
from bs4 import BeautifulSoup as bs
import urllib2
data = urllib2.urlopen("http://www.start.umd.edu/gtd/search/Results.aspx?page=1&casualties_type=b&casualties_max=&dtp2=all&country=93&charttype=line&chart=overtime&ob=GTDID&od=desc&expanded=yes#results-table")
html = data.read()
html
clear
soup = bs(html)
soup.findAll('tr')
soup.findAll('tr',{"class":"white"})
data_a = [t.text for t in soup.findAll('tr',{"class":"white"})]
data
data_a
data_a.split()
data_a[0].split()
len(data)
len(data_a)
data_a = [t.text.encode('ascii') for t in soup.findAll('tr',{"class":"white"})]
data_a
data_a[0].split()
for i in range(len(data_a)):
print data_a[i].split()
len(data_a[0])
len(data_a[0].split())
data_a[0].split()[0]
data_a[0].split()[1]
data_a[0].split()[2]
data_a[0].split()[3]
data_a[0].split()[4]
data_a[0].split()[5]
data_a[0].split()[6]
data_a[0].split()[7]
data_a[0].split()[8]
data_a[0].split()[9]
data_a[0].split()[10]
data_a[0].split()[11]
for i in range(len(data_a)):data_a[0].split()
for i in range(len(data_a)):
print data_a[i].split()[10]
for i in range(len(data_a)):
print data_a[i].split()[6]
for i in range(len(data_a)):
print data_a[i].split()[5]
for i in range(len(data_a)):
print data_a[i].split()[4]
for i in range(len(data_a)):
print data_a[i].split()[3]
for i in range(len(data_a)):
print data_a[i].split()[2]
for i in range(len(data_a)):
print data_a[i].split()[9]
d [[] for x in xrange(10)]
d = [[] for x in xrange(10)]
d
d = [[] for x in xrange(len(data_a))]
d
len(d)
d = [[] for x in xrange(len(data_a+1))]
d = [[] for x in xrange(len(data_a)+1)]
d
len(d)
for i in range(len(d)):
for n in range(len(data_a)):
d[i].append(data_a[n].split()[3])
d
d = [ [] for n in xrange(11+1) ]
d
clear
d[0]
data_a
data_a[0].split()
data_a[1].split()
data_a[2].split()
for i in range(len(data_a)):
d[0].append(data_a[1])
d
d = [[] for x in xrange(len(12))]
d = [[] for x in xrange(12)]
d
for i in range(len(data_a)):
d[0].append(data_a[i].split(1))
for i in range(len(data_a)):
d[0].append(data_a[i].split()[1])
d
for i in range(len(data_a)):
d[1].append(data_a[i].split()[2])
d
d[1] = []
d
len(d)
%save
ls
cd ~/dev/git/
cd gists/
ls
%save global-terrorist-database
ls
%save global-terrorist-database.py
import readline
readline.write_history_file('~/dev/git/gitst/history')
readline.write_history_file('~/dev/git/gitst/history')
readline.write_history_file('~/dev/git/gists/history')
readline.write_history_file('~/history')
readline.write_history_file('~/history')
%history
%history -r
ls
%history -r history
%history -f history