Created
October 13, 2013 18:05
-
-
Save hronecviktor/6965333 to your computer and use it in GitHub Desktop.
pbNew
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__author__ = 'zamr666' | |
import sys | |
import collections | |
def printLines(lines): | |
print("\nTime:\tGoing in:\tNumber:\t Direction:") | |
for _ in lines: | |
print(_.time,"\t",_.intime.center(7," "),"\t",_.number,"\t",_.direction) | |
if ((len(sys.argv)== 1) | (sys.argv in ["-h","--help"])): | |
print("No input given.") | |
exit() | |
_=sys.argv[1] | |
BusLine = collections.namedtuple("BusLine","time intime direction number") | |
lines = [] | |
BusLines = [] | |
_ = _.split("<tr>") | |
for a in _: | |
if "</b> (o " in a: | |
lines.append(a) | |
for _ in range(len(lines)): | |
line = lines[_] | |
lines[_] = lines[_].replace("<td>","") | |
lines[_] = lines[_].replace("</td>","") | |
lines[_] = lines[_].replace("<b>","") | |
lines[_] = lines[_].replace("<span>","") | |
lines[_] = lines[_].replace("</tr>","") | |
lines[_] = lines[_].split("</table>")[0] | |
BusLines.append(BusLine(lines[_][0:5],lines[_].split(" ")[2],lines[_].split("</span>")[1],lines[_].split("class=\"")[1].split("\"")[0].split(" ")[2])) | |
printLines(BusLines) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment