Problem Statement: Use boto3 library in Python to paginate through object versions of a S3 bucket from AWS Glue Data Catalog that is created in your accountApproach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: max_items, page_size and starting_token are the optional parameters for this function, while bucket_name is required parameters.max_items denote the total number of records to return. If the number of available records > max_items then a NextToken will be provided in the response to resume pagination.page_size denotes the size of each page.starting_token helps to paginate, and it uses NextKeyMarker from a ... Read More
In this article, we will see how to get the list of all versions of the object from S3 those are present in AWS Resource.ExampleList out all the versions of test.zip from Bucket_1/testfolder of S3.Problem Statement: Use boto3 library in Python to get list of all versions of the object from S3.Approach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: bucket_name is the required parameter.Step 3: Create an AWS session using boto3 libStep 4: Create an AWS client for s3Step 5: Now, list out all version of the object of the given bucket using ... Read More
In order to get the information about the widgets, tkinter provides a set of methods that can be used to test the widgets in an application. In order to get the list of all the child widgets, we can use the winfo_children() method.ExampleIn this example, we have defined some widgets in a frame and by using the winfo_children() method, we will print the list containing the names of all the widgets.#Import tkinter library from tkinter import * #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("750x200") #Create a frame frame= Frame(win) #Create label, button widgets Label(frame, ... Read More
Problem Statement: Use boto3 library in Python to paginate through all triggers from AWS Glue Data Catalog that is created in your accountApproach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: max_items, page_size and starting_token are the optional parameters for this functionmax_items denote the total number of records to return. If the number of available records > max_items, then a NextToken will be provided in the response to resume pagination.page_size denotes the size of each page.starting_token helps to paginate, and it uses NextToken from a previous response.Step 3: Create an AWS session using boto3 ... Read More
When it is required to check if a singly linked list is a palindrome or not, methods to add an element, get the previous node and to check if a palindrome is formed are defined.Below is a demonstration of the same −Example Live Democlass Node: def __init__(self, data): self.data = data self.next = None class LinkedList_struct: def __init__(self): self.head = None self.last_node = None def add_elements(self, data): if self.last_node is None: self.head = Node(data) ... Read More
We are familiar with popup and used it in many applications. Popup in a tkinter application can be created by creating an instance of Toplevel(root) window. For a particular application, we can trigger the popup on a button object.Let us create a Python script to close the underlying or the main window after displaying the popup. We can close the main window while residing in a popup window by using the withdraw() method.ExampleThrough this example, we will create a popup dialog that can be triggered after clicking a button. Once the popup will open, the parent window will close automatically.#Import ... Read More
Problem Statement: Use boto3 library in Python to paginate through all tables from AWS Glue Data Catalog that is created in your accountApproach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: max_items, page_size and starting_token are the optional parameters for this function, while database_name is required.max_items denote the total number of records to return. If the number of available records > max_items, then a NextToken will be provided in the response to resume pagination.page_size denotes the size of each page.starting_token helps to paginate, and it uses NextToken from a previous response.Step 3: Create an ... Read More
Problem Statement: Use boto3 library in Python to paginate through table versions of a table from AWS Glue Data Catalog that is created in your accountApproach/Algorithm to solve this problemStep 1: Import boto3 and botocore exceptions to handle exceptions.Step 2: max_items, page_size and starting_token are the optional parameters for this function, while database_name and table_name are required.max_items denote the total number of records to return. If the number of available records > max_items then a NextToken will be provided in the response to resume pagination.page_size denotes the size of each page.starting_token helps to paginate, and it uses NextToken from a ... Read More
In order to work with tkinter applications and widgets, we have to import the tkinter library in the environment. There are multiple ways to import the tkinter library in the notebook.Using from tkinter import *Using import tkinter as tkThe first method to import the tkinter library is the most common, as it comes with all the inbuilt methods or functions. In the general sense, we don’t have to explicitly override the method for the widgets. In this way, we can create the object of widgets just by using the widget constructor. It comes with all the modules defined in tkinter.However, ... Read More
When it is required to find tuples that have position elements from a list of tuples, list comprehension can be used.Below is a demonstration of the same −Example Live Demomy_list = [(56, 43), (-31, 21, 23), (51, -65, 26), (24, 56)] print("The list is : ") print(my_list) my_result = [sub for sub in my_list if all(elem >= 0 for elem in sub)] print("The positive elements are : ") print(my_result)OutputThe list is : [(56, 43), (-31, 21, 23), (51, -65, 26), (24, 56)] The positive elements are : [(56, 43), (24, 56)]ExplanationA list of tuples is defined, and is ... Read More