Hello All,
I tried running the below program in the 'Python 2.7.14 Shell', but I did not get any output at the end of the program.
f = open("C:/test/my_data.txt")
h = f.readline()
lines = f.readlines()
# select dno,sex,sum(sal) from emp
group by dno,sex;
res = {}
dno = w[-1].split("\n")[0]
sex = w[-2]
mykey = (dno,sex)
sal = int(w[2])
if res.get(mykey) == None:
res[mykey] = sal
else:
res[mykey] += sal
print("aggregations",res)
// my_data contains the following data :
id, name, sal, sex,deptno
101, Amar, 2000, M 11
102, Sai, 3000, F 11
103, Pran, 5000, M 12
Please help me
I tried running the below program in the 'Python 2.7.14 Shell', but I did not get any output at the end of the program.
f = open("C:/test/my_data.txt")
h = f.readline()
lines = f.readlines()
# select dno,sex,sum(sal) from emp
group by dno,sex;
res = {}
dno = w[-1].split("\n")[0]
sex = w[-2]
mykey = (dno,sex)
sal = int(w[2])
if res.get(mykey) == None:
res[mykey] = sal
else:
res[mykey] += sal
print("aggregations",res)
// my_data contains the following data :
id, name, sal, sex,deptno
101, Amar, 2000, M 11
102, Sai, 3000, F 11
103, Pran, 5000, M 12
Please help me