<div dir="ltr"><span class="Apple-style-span" style="background-color: transparent; border-collapse: separate; color: rgb(0, 0, 0); font-family: &#39;Times New Roman&#39;; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; font-size: medium;"><span class="Apple-style-span" style="font-family: &#39;lucida grande&#39;,tahoma,verdana,arial,sans-serif; font-size: 13px; white-space: pre-wrap;">Hi all!<br>
<br>I have a file with data structure derived from wvdial log:<br>Oct 14 11:03:45 cc000002695 pppd[3092]: Sent 3489538 bytes, received 43317854 bytes.<br><br>I want to get the 10th field of each line and get the sum for all lines (total my net data usage). In awk u can easily pop it using field variables e..g $10. Since im learning python on my own i thought this is a good way to learn but im stumped how to achieve this goal.<br>
I used open() and read line method to store the contents in a list but it is a list of string. I need it to be numbers. Iterating through the string list definitely is unwieldy. Can you guys advise best way how?<br><br>FWIW im a self learner and just relying from tutorial materials and this medium to learn python. Lead me to the right direction please :-)<br>
<br>My IDE is vim and ipython in debian linux.<br></span></span><br clear="all"><br>-- <br>Best Regards,<br>bibimidi<br><br><br>
</div>