Last active
April 7, 2020 01:11
-
-
Save santiago-salas-v/a6be1ebb1ef54cc41f870c2a72183211 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import re | |
a="""Stream 1 2 19 13 20 21 unit | |
molar phaseFraction [Vapor] 0.78573872 1 0.84155574 N/A 1 N/A | |
molar phaseFraction [Liquid] 0.21426128 0 0.15844426 1 0 1 | |
Vapor mole fraction [Methane] 0.0065941603 0.0065941603 0.0076360162 N/A 0.0076360162 N/A | |
Vapor mole fraction [Ethane] 0.00051999558 0.00051999558 0.00051098128 N/A 0.00051098128 N/A | |
Vapor mole fraction [Propane] 0.00069927477 0.00069927477 0.00045905695 N/A 0.00045905695 N/A | |
Vapor mole fraction [N-butane] 0.010953157 0.010953157 0.0032409075 N/A 0.0032409075 N/A | |
Vapor mole fraction [N-pentane] 0.018269691 0.018269691 0.0016300124 N/A 0.0016300124 N/A | |
Vapor mole fraction [N-hexane] 0.022798977 0.022798977 0.00058905142 N/A 0.00058905142 N/A | |
Vapor mole fraction [N-heptane] 0.021084667 0.021084667 0.00016589472 N/A 0.00016589472 N/A | |
Vapor mole fraction [N-octane] 0.015393901 0.015393901 3.5964501e-05 N/A 3.5964501e-05 N/A | |
Vapor mole fraction [N-nonane] 0.01047043 0.01047043 7.444376e-06 N/A 7.444376e-06 N/A | |
Vapor mole fraction [N-decane] 0.011794546 0.011794546 2.6006846e-06 N/A 2.6006846e-06 N/A | |
Vapor mole fraction [N-dodecane] 0.0061606272 0.0061606272 1.539027e-07 N/A 1.539027e-07 N/A | |
Vapor mole fraction [N-hexadecane] 0.00070300513 0.00070300513 2.8927609e-10 N/A 2.8927609e-10 N/A | |
Vapor mole fraction [N-nonacosane] 9.8414656e-07 9.8414656e-07 3.0367613e-18 N/A 0 N/A | |
Vapor mole fraction [Carbon monoxide] 0.0057610646 0.0057610646 0.0067766606 N/A 0.0067766606 N/A | |
Vapor mole fraction [Nitrogen] 7.1951021e-05 7.1951021e-05 8.4753591e-05 N/A 8.4753591e-05 N/A | |
Vapor mole fraction [Water] 0.046283512 0.046283512 0.0060640515 N/A 0.0060640515 N/A | |
Vapor mole fraction [N-docosane] 2.2501977e-05 2.2501977e-05 3.0571192e-14 N/A 3.0571192e-14 N/A | |
Vapor mole fraction [Hydrogen] 0.82241755 0.82241755 0.97279645 N/A 0.97279645 N/A | |
Liquid mole fraction [Methane] 0.00072983753 0.00072983733 0.0010604804 0.00072983753 0.0010604406 0.0010604804 | |
Liquid mole fraction [Ethane] 0.0001218808 0.00012188078 0.00056787386 0.0001218808 0.00056786523 0.00056787386 | |
Liquid mole fraction [Propane] 0.00028653209 0.00028653205 0.00197516 0.00028653209 0.0019751341 0.00197516 | |
Liquid mole fraction [N-butane] 0.0076485031 0.0076485019 0.051915755 0.0076485031 0.051915244 0.051915755 | |
Liquid mole fraction [N-pentane] 0.022071185 0.022071183 0.10664915 0.022071185 0.10664812 0.10664915 | |
Liquid mole fraction [N-hexane] 0.04577451 0.045774507 0.14076406 0.04577451 0.14076273 0.14076406 | |
Liquid mole fraction [N-heptane] 0.06879403 0.068794027 0.13219196 0.06879403 0.13219022 0.13219196 | |
Liquid mole fraction [N-octane] 0.082088807 0.082088806 0.096965555 0.082088807 0.096963671 0.096965555 | |
Liquid mole fraction [N-nonane] 0.09001802 0.090018021 0.066043195 0.09001802 0.066041548 0.066043195 | |
Liquid mole fraction [N-decane] 0.16294936 0.16294937 0.074425904 0.16294936 0.07442346 0.074425904 | |
Liquid mole fraction [N-dodecane] 0.21146207 0.21146208 0.038881167 0.21146207 0.038879101 0.038881167 | |
Liquid mole fraction [N-hexadecane] 0.14344623 0.14344624 0.0044369225 0.14344623 0.0044364169 0.0044369225 | |
Liquid mole fraction [N-nonacosane] 0.029494493 0.029494493 6.211311e-06 0.029494493 0 6.211311e-06 | |
Liquid mole fraction [Carbon monoxide] 0.00041337582 0.00041337568 0.00036686078 0.00041337582 0.00036684285 0.00036686078 | |
Liquid mole fraction [Nitrogen] 4.976153e-06 4.9761513e-06 3.9518568e-06 4.976153e-06 3.9516494e-06 3.9518568e-06 | |
Liquid mole fraction [Water] 0.033691975 0.033691976 0.25990386 0.033691975 0.25992457 0.25990386 | |
Liquid mole fraction [N-docosane] 0.050806559 0.050806562 0.00014201826 0.050806559 0.00014198879 0.00014201826 | |
Liquid mole fraction [Hydrogen] 0.050197657 0.050197639 0.023699907 0.050197657 0.023698697 0.023699907 | |
""" | |
groups=re.findall('^(Vapor|Liquid).*\[(.*)\]\s*[0-9]*\.[0-9]*[Ee]?\+?\-?[0-9]*\s*[0-9]*\.[0-9]*[Ee]?\+?\-?[0-9]*\s*([0-9]*\.[0-9]*[Ee]?\+?\-?[0-9]*)',a,re.MULTILINE) | |
for group in groups: | |
print(group[0]+'\t;'+group[1]+'\t;'+group[2].replace('.',',')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment