pyslha.py

changeset 141
869c16f9093b
parent 140
81b5c01084f4
child 144
c549f909067c
     1.1 --- a/pyslha.py	Sun Apr 10 12:18:08 2011 +0100
     1.2 +++ b/pyslha.py	Sun Apr 10 12:24:01 2011 +0100
     1.3 @@ -196,13 +196,13 @@
     1.4          ## Handle BLOCK/DECAY start lines
     1.5          if line.upper().startswith("BLOCK"):
     1.6              #print line
     1.7 -            match = re.match(r"BLOCK\s+(\w+)(\s+Q=\s*.+)?", line.upper())
     1.8 +            match = re.match(r"BLOCK\s+(\w+)(\s+Q\s*=\s*.+)?", line.upper())
     1.9              if not match:
    1.10                  continue
    1.11              blockname = match.group(1)
    1.12              qstr = match.group(2)
    1.13              if qstr is not None:
    1.14 -                qstr = qstr[2:].strip()
    1.15 +                qstr = qstr[qstr.find("=")+1:].strip()
    1.16              currentblock = blockname
    1.17              currentdecay = None
    1.18              blocks[blockname] = Block(blockname, q=qstr)
    1.19 @@ -293,7 +293,7 @@
    1.20      for bname, b in sorted(blocks.iteritems()):
    1.21          namestr = b.name
    1.22          if b.q is not None:
    1.23 -            namestr += " Q= %e" % b.q
    1.24 +            namestr += " Q= %e" % float(b.q)
    1.25          out += "BLOCK %s\n" % namestr
    1.26          for s in dict_hier_strs(b.entries):
    1.27              out += sep + s + "\n"

mercurial