Python Forum
Correct data structure for this problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correct data structure for this problem
#11
Hi,

I need to parse the lines in the source file, simply looping. Then, split each line on the asterisk.
The first part determines segments (there's an opening tag and a closing tag).
Within each segment, the first part of the line has an ID to denote a different block of lines that belong together (the same transaction).

For the prefix in the output file, it's simply some of the parts of the splitted line text. So asterisk splits up the line and we need to grab the 3rd or 4th item, something like this. That is not the difficult part.

The difficult part is identifying the different segments, then blocks within a segment. I have it all working in VBA, but now I am looking at performance and speed :-) that's why I'm here with Python. The only thing I was unsure of, is how to store the information on line numbers such that I can use it in a second pass to form the output text file.
Reply


Messages In This Thread
Correct data structure for this problem - by Wigi - Oct-06-2020, 11:12 AM
RE: Correct data structure for this problem - by Wigi - Oct-06-2020, 09:18 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extracting the correct data from a CSV file S2G 6 403 Jun-03-2024, 04:50 PM
Last Post: snippsat
  How can I add certain elements in this 2d data structure and calculate a mean TheOddCircle 3 1,693 May-27-2022, 09:09 AM
Last Post: paul18fr
  Looking for data/info on a perticular data-proccesing problem. MvGulik 9 4,174 May-01-2021, 07:43 AM
Last Post: MvGulik
  Appropriate data-structure / design for business-day relations (week/month-wise) sx999 2 2,936 Apr-23-2021, 08:09 AM
Last Post: sx999
  what data structure to use? Winfried 4 2,961 Mar-16-2021, 12:11 PM
Last Post: buran
  Yahoo_fin, Pandas: how to convert data table structure in csv file detlefschmitt 14 8,193 Feb-15-2021, 12:58 PM
Last Post: detlefschmitt
  How to use Bunch data structure moish 2 3,087 Dec-24-2020, 06:25 PM
Last Post: deanhystad
  difficulties to chage json data structure using json module in python Sibdar 1 2,195 Apr-03-2020, 06:47 PM
Last Post: micseydel
  File system representation in a data structure Alfalfa 1 2,172 Dec-18-2019, 01:56 AM
Last Post: Alfalfa
  Custom data structure icm63 2 2,644 Mar-27-2019, 02:40 AM
Last Post: icm63

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020