Skip to content

Python Challenge #3

Description

@ryan-duve

I would like to submit a solution for the challenge on the bottom of this page:

If you think that this could be done significaanly easier in python than the python solution above, here is a link to a smaller file on which you can try your code. I will be glad to share the solution on this page.

data = {"Frequencies":[], "Frc consts":[], "IR Inten":[]}

with open("H2O.log") as f:
    for line in f.readlines():
        for label in data:
            if label in line:
                data[label].extend(line.split()[-3:])

for line in zip(*data.values()):
    print(" ".join(line))

I hope it is a useful comparison to the awk script. Please let me know if you'd like any explanation on how it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions