Search Results

Search found 2 results on 1 pages for 'gatechgrad'.

Page 1/1 | 1 

  • Tokenizing a string with unequal number of spaces between fields

    - by gatechgrad
    I am tryint to tokenize entries from a file. However I am not able to use the line.split("") option because of unequal number of spaces between files. I am copying a few lines from my file below: "08-09-2010 21:21:46 00:22:7f:a6:9b:69 -79" "08-09-2010 21:21:46 04:4f:aa:b4:49:49 -79" "08-09-2010 21:21:46 04:4f:aa:31:4e:59 tikona 18002090044 -83" "08-09-2010 21:21:46 00:22:7f:26:9b:69 tikona 18002090044 -74" "08-09-2010 21:21:46 04:4f:aa:34:0d:c9 tikona 18002090044 -82" "08-09-2010 21:21:46 04:4f:aa:71:4e:59 -85" "08-09-2010 21:21:46 04:4f:aa:34:21:89 tikona 18002090044 -75" "08-09-2010 21:21:46 04:4f:aa:34:49:49 tikona 18002090044 -77" "08-09-2010 21:21:46 04:4f:aa:74:0d:c9 -85" "08-09-2010 21:22:47 18 APs were seen " I need to access the first column (which is a datetime object) the second column (00:22...) and the last column (-79 etc.). I have no trouble accessing the first and second columns, but not the last column. When I do a info=line.spilt(""), since the third column might or might no entries, I am not able to determine the token number. How do i access the 4th column? Is there a way i can use info[i].contains(" -")?

    Read the article

  • Create function in python to find the highest of all function arguments, and return the "tag" of the value.

    - by gatechgrad
    Consider the following: p1=1; p2=5; p3=7; highest=max(p1,p2,p3). The max function would return 7. I am looking to create a similar function, which would return "p3". I have created a small function (by simple comparisons) for the above example, shown below. however I am having trouble when the number of arguments go up. def highest(p1,p2,p3) if (p1p2) and (p1p3): return "p1" if (p2p1) and (p2p3): return "p2" if (p3p1) and (p3p1): return "p3". Is there a simpler way to do this

    Read the article

1