Python Forum

Full Version: Reading Multiple text Files in pyhton
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I have been working on .txt format files. Almost 13 k files and wanted to extract Age and gender from all the files in separate csv file . I have tired number of different methods but I'm unable to do that.
Pleas help me out.

Here is how does the data looks like:


Output:
A0002 12 500 5000 12-May-2020 12:33:59 A0002.mat 16+24 1000/mV 16 0 -1 -1 0 I A0002.mat 16+24 1000/mV 16 0 -15 22 0 II A0002.mat 16+24 1000/mV 16 0 -15 -8 0 III A0002.mat 16+24 1000/mV 16 0 7 5 0 aVR A0002.mat 16+24 1000/mV 16 0 8 23 0 aVL A0002.mat 16+24 1000/mV 16 0 -16 -21 0 aVF A0002.mat 16+24 1000/mV 16 0 44 16 0 V1 A0002.mat 16+24 1000/mV 16 0 71 -29 0 V2 A0002.mat 16+24 1000/mV 16 0 30 -38 0 V3 A0002.mat 16+24 1000/mV 16 0 0 11 0 V4 A0002.mat 16+24 1000/mV 16 0 -5 49 0 V5 A0002.mat 16+24 1000/mV 16 0 -11 32 0 V6 #Age: 49 #Sex: Female #Dx: 426783006 #Rx: Unknown #Hx: Unknown #Sx: Unknown
Please show some of the methods you have tried.