S
S
sazhyk2017-02-20 14:55:13
Django
sazhyk, 2017-02-20 14:55:13

How to parse files using python?

There is a text file, the data in which has a strict structure

...
##########^########^#####^####^####^####^####
##########^########^#####^####^####^####^####
##########^########^#####^####^####^####^####
...

It is necessary to load it in one form, using separators ^to separate it into fields and display it in another form for editing, followed by saving it to a new file of the same structure.
I have never done anything close to that, and I vaguely imagine what needs to be done. At least in which direction to dig, what libraries can there be for this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2017-02-20
@sim3x

with open(filename, 'r', encoding='utf-8') as f:
    for l in f:
        l.split('^')

+
stackoverflow.com/questions/22390416/setting-initi...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question