Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Iam new to Python Need Help
#1
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
Reply


Messages In This Thread
Iam new to Python Need Help - by hitesh222002 - May-24-2018, 03:33 PM
RE: Iam new to Python Need Help - by nilamo - May-24-2018, 08:07 PM
RE: Iam new to Python Need Help - by buran - May-25-2018, 06:06 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020