Python Forum
I need to get only string datatype and report in excel file. - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: I need to get only string datatype and report in excel file. (/thread-23122.html)



I need to get only string datatype and report in excel file. - akshay3210 - Dec-12-2019

Hello,
I have a python script which uses a source text file as an input.

The text file contains the data of string, numeric, boolean and action data types format.

I need to strip of the numeric, boolean and action data and parse only string data type and log in the csv.

My text file contains the following script:

<S t='a' s='3'/>SetRTEConfig,Done,,<S t='a' s='3'/>LogTestertName,Passed,,<S t='n' c='GT' s='7'/>{PowerUpBed}VerifyBedCurrentDraw,0.271440,Passed,0.080000,,Amps RMS,,<S t='s' c='IgnoreCase' s='5'/>{LogTestertName}LogTesterName,"TS-0418A",Passed,"TS-0418A",,

where t=a is the action data type which i want to strip off and parse only <S t='s' the last one which is string.
and log to csv

How can i do it

Any help is appreciated,

Thank you


RE: I need to get only string datatype and report in excel file. - Malt - Dec-12-2019

So, you want to log the following things to a csv file,
s='3', SetRTEConfig,Done,,,LogTestertName,Passed,,<S t='n' c='GT' s='7',{PowerUpBed}VerifyBedCurrentDraw,Passed,Amps,RMS,,<S t='s' c='IgnoreCase' s='5',{LogTestertName}LogTesterName,"TS-0418A",Passed,"TS-0418A"
Do you need to strip special characters too? How about alpha numeric items?


RE: I need to get only string datatype and report in excel file. - akshay3210 - Dec-12-2019

Hi,

I need to log only
<S t='s' c='IgnoreCase' s='5',{LogTestertName}LogTesterName,"TS-0418A",Passed,"TS-0418A"

and strip off other data. and log in a file

Here are my scripts

https://1drv.ms/u/s!Av5Z02PBCxYcmCVGa7ToO2B0f1kh?e=rdPJsZ


RE: I need to get only string datatype and report in excel file. - akshay3210 - Dec-12-2019

I need to fetch only those data starting from
<S t='s'
which is basically a string data type