von Karolus » Mo, 03.04.2023 20:07
Hallo
zum Spass mal mit python in Blöcken zu 6 Zeilen in eine Liste:
Code: Alles auswählen
from more_itertools import batched
with open("test.txt") as testfile:
out = batched(testfile.read().split(), 6)
print(list(out))
was dabei rauskommt ist IMHO keine Grundlage zur Erzeugung einer brauchbaren …csv -datei:
Code: Alles auswählen
[['W-',
'Wasserversorgungsverband',
'Euskirchen',
'-Swisttal',
'-123,12',
'EUR'],
['123.123.123-1', 'ABS', '03/2023', 'xxxxx', 'Weg', 'xx,'],
['XX-Dorf', '03.04.2023', 'SEPA', 'Lastschrift', 'DO', 'Drillisch'],
['Online', 'GmbH', '-6,99', 'EUR', 'C123123', 'U123123123'],
['B123123', 'hand', 'yvertrag.de', '09.03.2023', 'SEPA', 'Lastschrift'],
['EP', 'ENTEGA', 'Plus', 'GmbH', '-123,12', 'EUR'],
['Vertragskonto', '123123123', 'XX-Dorf', ',', 'xxxxx', 'Weg'],
['xx', 'Abschlag', 'Strom', '/Gas', '07.03.2023', 'SEPA'],
['Lastschrift']]
Hallo
zum Spass mal mit python in Blöcken zu 6 Zeilen in eine Liste:
[code=php]from more_itertools import batched
with open("test.txt") as testfile:
out = batched(testfile.read().split(), 6)
print(list(out))[/code]
was dabei rauskommt ist IMHO keine Grundlage zur Erzeugung einer brauchbaren …csv -datei:
[code=php][['W-',
'Wasserversorgungsverband',
'Euskirchen',
'-Swisttal',
'-123,12',
'EUR'],
['123.123.123-1', 'ABS', '03/2023', 'xxxxx', 'Weg', 'xx,'],
['XX-Dorf', '03.04.2023', 'SEPA', 'Lastschrift', 'DO', 'Drillisch'],
['Online', 'GmbH', '-6,99', 'EUR', 'C123123', 'U123123123'],
['B123123', 'hand', 'yvertrag.de', '09.03.2023', 'SEPA', 'Lastschrift'],
['EP', 'ENTEGA', 'Plus', 'GmbH', '-123,12', 'EUR'],
['Vertragskonto', '123123123', 'XX-Dorf', ',', 'xxxxx', 'Weg'],
['xx', 'Abschlag', 'Strom', '/Gas', '07.03.2023', 'SEPA'],
['Lastschrift']][/code]