ans for my python questions

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • umarajeswari
    New Member
    • Mar 2007
    • 3

    ans for my python questions

    i hav a xml file like this ,file name is well-test-files.txt

    <AlrtType>Charg eBack</AlrtType>

    <TrnType>Debi t</TrnType>

    <Amt>1.00</Amt>

    <CurCode>USD</CurCode>

    <ActionCode>Fin ancialTran</ActionCode>


    1.Calculate how many lines are in wells_test_file .txt

    2. Get values from all tags in wells_test_file .txt using split command
  • ghostdog74
    Recognized Expert Contributor
    • Apr 2006
    • 511

    #2
    Originally posted by umarajeswari
    i hav a xml file like this ,file name is well-test-files.txt

    <AlrtType>Charg eBack</AlrtType>

    <TrnType>Debi t</TrnType>

    <Amt>1.00</Amt>

    <CurCode>USD</CurCode>

    <ActionCode>Fin ancialTran</ActionCode>


    1.Calculate how many lines are in wells_test_file .txt

    2. Get values from all tags in wells_test_file .txt using split command
    I suspect this is homework , so i give you hints instead.
    you can use a for loop, enumerate() and get the last count of line number.
    or you can use readlines() , then find the length of the lines read. Be careful of reading in newlines, which you may not want to count as 1

    Comment

    Working...