Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pattern Split String
#1
I have an interesting challenge have few patterned records and i need to split it intelligently into a dictionary

Eg of records in file are like below. Each Record Type can have different definition. And I need to read that record and map its place holders correctly. The size of record type will remain static or fixed
<Counter 5 digit><Record Type><Rec Defn Attribute 1><Rec Defn Attribute 2>..etc

00001000A20181220233445 NAMEOFACTOR10023.431-84-203,FLAT-2A;BlockC,COUNTRY
00002000A20181220233445 NAMEOFACTOR20023.431-84-203,FLAT-2A;BlockC,COUNTRY

First 5 is counter,
Next 4 is record type defintion
Next 14 is datetime i.e in YYYYMMDDHHMISS format
Next 14 is Name of Person
Next 7 floating point number
Reminder address.

This is sample like this based on definition fo a record type the pattern will be different. How can i have a nice structural Python program which i can define the structure or pattern of a record and split each record in correct definition elements
Reply


Messages In This Thread
Pattern Split String - by sripylearn - Aug-10-2018, 04:03 PM
RE: Pattern Split String - by buran - Aug-10-2018, 04:10 PM
RE: Pattern Split String - by sripylearn - Aug-10-2018, 05:19 PM
RE: Pattern Split String - by buran - Aug-10-2018, 07:01 PM
RE: Pattern Split String - by buran - Aug-10-2018, 07:38 PM
RE: Pattern Split String - by buran - Aug-10-2018, 08:07 PM
RE: Pattern Split String - by sripylearn - Aug-12-2018, 04:20 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  doing string split with 2 or more split characters Skaperen 22 2,600 Aug-13-2023, 01:57 AM
Last Post: Skaperen
Sad How to split a String from Text Input into 40 char chunks? lastyle 7 1,195 Aug-01-2023, 09:36 AM
Last Post: Pedroski55
  [split] Parse Nested JSON String in Python mmm07 4 1,581 Mar-28-2023, 06:07 PM
Last Post: snippsat
  Split string using variable found in a list japo85 2 1,324 Jul-11-2022, 08:52 AM
Last Post: japo85
  Split string knob 2 1,899 Nov-19-2021, 10:27 AM
Last Post: ghoul
  Split string between two different delimiters, with exceptions DreamingInsanity 2 2,055 Aug-24-2020, 08:23 AM
Last Post: DreamingInsanity
  split string enigma619 1 2,098 May-20-2020, 02:47 PM
Last Post: perfringo
  Split string with multiple delimiters and keep the string in "groups" DreamingInsanity 4 6,578 May-12-2020, 09:31 AM
Last Post: DeaD_EyE
  Split a long string into other strings with no delimiters/characters krewlaz 4 2,812 Nov-15-2019, 02:48 PM
Last Post: ichabod801
  input string split Eric7Giants 3 3,051 Nov-13-2019, 07:19 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

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