Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to do in Python
#7
(May-24-2018, 03:53 PM)oldcity Wrote:
    for line in file:
      pdate,catg,amt,howp = line.split(",")
      catg = int(catg)
      tamt = tamt + float(amt)
      x = x + 1
      print 'cnt > ',x ,'catg  :', catg

That's your entire file processing. If you want to do more with each line, then whatever processing you're trying to do to each line, should be within the for block.
Reply


Messages In This Thread
How to do in Python - by oldcity - Apr-26-2018, 03:20 PM
RE: How to do in Python - by nilamo - Apr-26-2018, 03:45 PM
RE: How to do in Python - by oldcity - Apr-27-2018, 03:07 PM
RE: How to do in Python - by nilamo - Apr-27-2018, 03:22 PM
RE: How to do in Python - by oldcity - May-24-2018, 03:53 PM
RE: How to do in Python - by snippsat - May-24-2018, 06:22 PM
RE: How to do in Python - by nilamo - May-24-2018, 06:39 PM

Forum Jump:

User Panel Messages

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