1

Am able to read from API and write to a list but this is in this format: ('AAA','FF','LL') ('BBB','SS','DD')

Can how can I iterate nested to get the information from first row as AAA, FF,LL individually.

Thank you. AJ

1 Answer 1

0

Python - Parsing JSON formatted text file with regex

This answer will help you to process your input data. I'd suggest the following code structure. I'll provide some pseudo-code:

list1
for item in APIInput:
    //Find each element in item by dividing the string on commas, remove ( and '
    //take each element and put it into another list (list2)
    //Add that list (list2) to list1

RegEx is very powerful for this type of work.

Sign up to request clarification or add additional context in comments.

6 Comments

try this: for item in YourList: print item
I get output as ('AAA','FF',LL)
Are you putting each element of the API return into a list? Or are you doing something like this? variable = APIList[1] I'd suggest using RegEx to parse your input
print item gives output as ('apple', 'Fruit','red') ('orange', 'Fruit','orange') ('Cucumber', 'Veggie', 'green')
from API am getting the response data. data = response.json()
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.