I coudn't find a solution and need help. I read a very hugh vCard text file with readline() on python3. Now I have the problem, that some long text lines goes over multiple line like:
item1.ADR;type=HOME;type=pref:;;27-28\, Yakyu-cho 5-chome\nTokyo;Higashimat
suyama-shi;Saitama;355-8603;Japan
I search the content with:
if re.search (r'.ADR;', elm):
adr_list.append(elm)
may list looks:
['', '', '27-28\\, Yakyu-cho 5-chome\\nTokyo', 'Higashimat\n']
with line.strip():
['', '', '27-28\\, Yakyu-cho 5-chome\\nTokyo', 'Higashimat']
The desired output should look like this:
['', '', '27-28', 'Yakyu-cho 5-chome','Tokyo', 'Higashimatsuyama-shi','Saitama','355-8603','Japan']
I used also rstrip(), but I can't get the right solution.
Is there an easy way with readline() to detect the linebreak and concatenate the next related line/s?