Python Forum

Full Version: Help with filtering in Python
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi, i am new to python and trying to learn a new language.

I am attempting to filter some output, but can't get my head around the syntax.

def filter_user_pools():
listpools = client.list_user_pools.filter(
Filters=[{'Id': 'UserPoolId'}])
for list in listpools:
    print(list.Id)
I am trying to output the filter the following output

{'UserPools': [{'Id': 'eu-west-1_asdasdg34', 'Name': 'JenkinsDevelopMarketplace', 'LambdaConfig': {'PreSignUp':...
I want the second field - eu-west_1

Any help, will be appericated.
The code doesn't run as it is, the indentation has gone, what is a client object? where does the input come from ?.
import boto3

client = boto3.client('cognito-idp')

def user_pool():
    response = client.list_user_pools(
        NextToken="PaginationKeyType",
        MaxResults=20
    )