-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsec.py
76 lines (58 loc) · 1.52 KB
/
sec.py
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
#!/user/bin/env python
#coding:utf-8
import mysql.connector
def select():
data = []
con = mysql.connector.connect(host='47.75.10.105',user='sel_er',password='1234',database='forex')
#cursor = con.cursor()
selectString = "select open,high,close,low from EUR_USD limit 10"
cursor=con.cursor(buffered=True)
cursor.execute(selectString)
for (open,high,close,low) in cursor:
data.append([open,high,close,low])
#print("open=",open,"\thigh=",high,"\tclose=",close," \tlow=",low)
for i in range(0,len(data)):
print("data[",i,"]=",data[i])
cursor.close()
con.close()
if __name__ == '__main__':
main()
select()
# class A():
# 'Common'
# def __init__(self,a,b):
# self.__a = a
# self.__b = b
# def getA(self):
# #return self.__a
# print('a='+(str)(self.__a)+' b='+(str)(self.__b))
# def setA(self,a1):
# self.__a = a1
# print('a after modify:'+(str)(self.__a))
# def __str__(self):
# return 'ver (%d,%d)' % (self.__a,self.__b)
# def __add__(self,other):
# return A(self.__a+other.__a , self.__b+other.__b)
# def __sub__(self,other):
# return A(self.__a-other.__a , self.__b-other.__b)
# def main():
# a1 = A(10,20)
# a2 = A(5,8)
# print(a1-a2)
# if __name__ == '__main__':
# main()
# aa = A(10,20)
# aa.c = 30
# if hasattr(aa,'c'):
# print(aa.c)
# print(hasattr(aa,'c'))
# print ("A.__doc__:", A.__doc__)
#
#
# aa.getA()
# aa.setA(15)
# if __name__ == '__main__':
# main()
#
# aaa['first'] = 1;
# print(aaa['first'])