![]() |
Parsing Text file having repeated value key pair using python - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Parsing Text file having repeated value key pair using python (/thread-12003.html) |
Parsing Text file having repeated value key pair using python - manussnair - Aug-04-2018 I have a text file that has the pattern as below..I would like to parse the values for each " An instance of Alert" and assign the values to the variables number,type,source etc..... What is the best option to accomplish this
RE: Parsing Text file having repeated value key pair using python - buran - Aug-04-2018 loop over file line by line when the line is An instance of Alert - that's new alert read following lines, split at = and you have key/value pair RE: Parsing Text file having repeated value key pair using python - manussnair - Aug-04-2018 (Aug-04-2018, 07:36 PM)buran Wrote: loop over file line by lineDo you have an example pls RE: Parsing Text file having repeated value key pair using python - micseydel - Aug-04-2018 (Aug-04-2018, 07:45 PM)manussnair Wrote: Do you have an example plsWe get lot of people coming here and basically wanting us to do their homework. Because of this, we ask that all people show a code attempt at their problem (it doesn't matter if yours isn't homework). We have a whole tutorials section if you're having a hard time getting started. |