Skip to content
Advertisement

Python How do i filter out multiple strings from a big string then put it in a .txt file

So i have this piece of code here:

JavaScript

I get everything i want from here but so i can f.write i need to put it into a string lstr = ' '.join(map(str, Outlook_data))

So now im just left with this:

JavaScript

My problem is that i need to filter out multiple 'name': 'xxx', 'shortVolume': xxx, 'longVolume': xxx

then i need to save them into multiple txt files. For example EURUSD.txt contains name short volume and long volume, then another file GBPUSD.txt etc.

Any help is appreciated thanks in advance

Advertisement

Answer

from what I understand it, all you need is a dynamic file location that is based on name

JavaScript

enter image description here

PS: you can format the file contents and the file location as required

Advertisement