Parser needed.

Skybuck Flying skybuck2000 at hotmail.com
Mon Jun 1 21:27:34 EDT 2015


Ok, so far so good, a little start has been made.

Text file is read into lines... I am not so sure if this is a good idea...

Maybe it's easier if the entire file is one gigant array of characters 
instead of fragmented lines.

However I don't know yet exactly how to read as one gigant array of 
characters.

I don't really like this line approach but maybe it's nice:

But I am not faced with a new problem: "How to process individually lines".

So this solution has created more problems than it solves :)

BotDemoFolder = "C:\\Games\\Startrek Online\\Startrek Online\\Cryptic 
Studios\\Star Trek Online\\Live\\demos"
BotDemoFile = "SpaceFleetAlert.demo"

import time

def ParseDemoLines( ParaLines ):
print "Parsing " + str( len(ParaLines) ) + " lines."

for LineIndex in range(0, len(ParaLines)):
  if "{" in ParaLines[LineIndex]: # how to process a line.. hmmm...
   print "yup"
return

def Main():
DemoFilePath = BotDemoFolder + "\\" + BotDemoFile

FileObject = open( DemoFilePath, "r")

DemoLines = FileObject.readlines()

ParseDemoLines( DemoLines )

# print DemoLines

FileObject.close()
return

print "program started"

Tick1 = time.time()
Main()
Tick2 = time.time()

Seconds = Tick2 - Tick1

print "Time in seconds: " + str(Seconds)

print "program finished"

Bye,
  Skybuck.





More information about the Python-list mailing list