Skip to main content

Posts

How to create a dynamic JSON file from reading data through an excel in python

 Below is the program on how to create a dynamic JSON file from reading data through an excel file as input for json in python.  First, install openpyxl from the following command to read the data from an excel file in python pip install openpyxl import os import openpyxl import json # create a JSON file to write dynamic JSON data. f = open("C:\\Users\\My_Dyanamic_JSON_Test".json", "a") # Open excel file for input path = "C:\\Users\\Excel_input_File.xlsx" # create workbook object for excel file wb_obj = openpyxl.load_workbook(path) # create a workbook sheet object for the excel file sheet_obj = wb_obj["Sheet1"] # get the data from the workbook sheet object from an excel file Row1_cell1 = sheet_obj["A" + str(1)] Row1_cell2 = sheet_obj["B" + str(1)] Row1_cell3 = sheet_obj["C" + str(1)] Row1_cell4 = sheet_obj["D" + str(1)] Row1_cell5 = sheet_obj["E" + str(1)] Row1_cell6 = sheet_obj["F"...

Json to excel in Python and Read Json file content in Python

  Below is the program to convert JSON file content into excel in Python. For this, you need to import json import json import csv import pandas as pd from payLoad import * json_file = {     "key1":"Value1",     "key2":"Value2",     "key3":"Value3", } pd.DataFrame(json_file).to_excel("excel.xlsx") ===================================================================== Below is the program to Read Json file content in Python For this, you need to import JSON import json with open('C:\\Users\\my_json_test_file.json') as f:     data = json.load(f) print(data)

How to connect to a remote database in Python

 Following is the program which will guide you on how to connect to a remote database in Python. For this first, you need to install the database connector and then use the following code.  You can install the connector with the following command: $> pip install <your database connector MySQL/memsql> import mysql.connector from mysql.connector import Error try:     connection = mysql.connector.connect(host='<provide remote hostname here>',                                          database='<provide database name here>',                                          user='<userid>',                                          password='<...

Python programs for printing patterns

  Here are some examples of Python programs for printing patterns: To print a triangle pattern: def triangle(n):     for i in range(1, n+1):         print(" "*(n-i) + "*"*(2*i-1)) triangle(5) Output: * *** ***** ******* ********* ============================================================ To print a pyramid pattern: def pyramid(n): for i in range(1, n+1): print(" "*(n-i) + "*"*(2*i-1)) pyramid(5) Output: * *** ***** ******* ********* ******* ***** *** * ============================================================ To print a diamond pattern: def diamond(n): for i in range(1, n+1): print(" "*(n-i) + "*"*(2*i-1)) for i in range(n-1, 0, -1): print(" "*(n-i) + "*"*(2*i-1)) diamond(5)     *    ***   *****  ******* *********  *******   *****    ***     *

How to get a Wi-Fi password of any active Wi-Fi connection

 If you want to get the Fi-Wi password or If you don't know it and you have to find it then below are the windows commands by which you will bale to find out the password for any Wi-Fi connection. 1. First you need to use below commands on windows console in order to see all active Wi.Fi connections: Command Syntax: wlan show profile It will list all active available Wi-Fi connections. 2. Then From the list of all available Wi-Fi connections you can able to get the password of any one of them and can use it to connect. Below is the syntax for the same. Command Syntax: wlan show profile <any wifi connection name mention here> Key=clear Hope this artical will help you. Thanks for visit to my blog.

Introduction to The API / What is API

1. What is API ? ○ An API (Application Programming Interface) is a software intermediary that enables two applications to communicate with each other. It comprises a number of subroutine definitions, logs, and tools for creating application software. ○ In an API testing interview, you could be asked to give some API examples, here are the well-known ones: Google Maps API, Amazon Advertising API, Twitter API, YouTube API, etc. 2. What is API Testing? ○ In the modern development world, many web applications are designed based on three-tier architecture model. These are: ○ Presentation Tier – User Interface (UI) ○ Logic Tier – Business logic is written in this tier. It is also called Business Tier. (API) ○ Data Tier – Here information and data is stored and retrieved from a Database. (DB) ○ Ideally, these three layers (tiers) should not know anything about the platform, technology, and structure of each other. We can test UI with GUI testing tools and we can test logic tier (API) with API...

JAVA MySQL database connectivity

 JAVA MySQL database connectivity  sample program Below is the the code for Java MySQL database create connection and fetch the data from the database. You need to download Jar or add dependency for java MySQL connector. Please refer following link for the same: https://mvnrepository.com/artifact/mysql/mysql-connector-java Below is the sample code: package test_mysql_connection_demo; import java.awt.BorderLayout; import java.sql.*; import java.util.ArrayList; import java.util.Vector; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTable; public class Test_mysql_connection_demo { public static void main(String args[]){     Test_mysql tm = new Test_mysql(); tm.conData(); boolean b = tm.exSQL("select * from student"); System.out.println(b); }   } class Test_mysql { public Connection con; void conData() {     try { ...