Hi All i am having a python code i have to convert this to java i have placed the code below import boto3 import sys import re import json def get_kv_map(file_name): with open(file_name, 'rb') as file: img_test = file.read() bytes_test = bytearray(img_test) print('Image loaded', file_name) # process using image bytes client = boto3.client('textract') response = client.analyze_document(Document={'Bytes': bytes_test}, FeatureTypes=['FORMS']) # Get the text blocks blocks=response['Blocks'] # get key and value maps key_map = {} value_map = {} block_map = {} for block in blocks: block_id = block['Id'] block_map[block_id] = block if block['BlockType'] == "KEY_VALUE_SET": if 'KEY' in block['EntityTypes']: key_map[block_id] = block …

Member Avatar
Member Avatar
+0 forum 1

Python-wxPython Tutorial This tutorial will take you through the basics of wxPython. ##Introduction: Let's face it. I am a dinosaur. I got my computer science degree in the mid 70s. And it won't be long before **I** am in **my** mid 70s. So why am I trying to learn Python? Mostly because learning new things keeps my brain active. And besides, nobody on Daniweb seems to be asking questions about vb.Net anymore. So I thought I'd give it a try. After a few weeks of puttering I managed to learn enough Python to rewrite all of my vbscripts (stop laughing, …

Member Avatar
Member Avatar
+7 forum 27

# Find minimum integer coefficients for a chemical reaction like # A * NaOH + B * H2SO4 -> C * Na2SO4 + D * H20 import sympy import re # match a single element and optional count, like Na2 ELEMENT_CLAUSE = re.compile("([A-Z][a-z]?)([0-9]*)") def parse_compound(compound): """ Given a chemical compound like Na2SO4, return a dict of element counts like {"Na":2, "S":1, "O":4} """ assert "(" not in compound, "This parser doesn't grok subclauses" return {el: (int(num) if num else 1) for el, num in ELEMENT_CLAUSE.findall(compound)} def main(): print("\nPlease enter left-hand list of compounds, separated by spaces:") lhs_strings = input().split() lhs_compounds …

Member Avatar
Member Avatar
+0 forum 2

Tyl is a programming language that is intended for curious people who are interested in software development, as well as for intermediate and experienced developers who want to try a different programming language. Some of Tyl features: - Clean code - Symbolized keywords - One-line statements - System modules & functions - Cascaded variables declaration - Automatic type inference Tyl Software includes the following modules: - Tyl Symbolizer - Tyl Parser - Tyl Statement Generator - Tyl Launcher - Tyl Compiler - Web Files Generator & Automation Details can be found at: Tyl Official Website: https://tyl-lang.dev Twitter: https://twitter.com/TylLang (@TylLang) Facebook: …

Member Avatar
Member Avatar
+1 forum 8

HERE IS MY CODE https://repl.it/@ZararImtiaz/Final-PROJECY

Member Avatar
Member Avatar
-1 forum 5

Hi Dani, I'm new to Python . I started working on an automation project where i need to connect to a SunOS server through a windows jump server and run commands to get output on my local machine. I checked this existing module on python called jumpssh but not sure if it's the right one for me or if there is a better alternative by using subprocess or any other modules. To accomplish this manually, I'm doing an RDP to the jump server and then connecting to target server through putty. Any help would be appreciated. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

Hi. I'm trying to convert my python file into pseudo code but I have no idea of how pseudo code work. continueAnswer = input("Please enter either continue to carry on with the program or end to stop it: ") continueAnswer=continueAnswer.upper() while continueAnswer == 'C': while True: try: print('') encodeORdecode = input("Type E for encode or D for decode: ") if encodeORdecode != 'e' and encodeORdecode != 'd' and endChoice !='END' and endChoice !='NO': raise ValueError break except ValueError: print("Invalid Choice!! Please try again") step=int(input("Plese enter a number for what you want the offset to be: ")) #working #encoding if encodeORdecode …

Member Avatar
Member Avatar
+0 forum 5

Sorry for the lousy title, "InterProcess Communication" was too long Basically, I'm looking to use the native `_winapi` and `msvcrt` modules to launch an integrated python interpreter and communicate with it over pipes I can't find anything on Google or DDG, and I've been searching for days, but nobody uses these modules for some reason... I already have the foundation with a 1-way Parent->Child pipe that works, but it's giving me a few issues: 1: I can't seem to get a 2nd Child->Parent pipe to run without the program hanging 2: the output of the subprocess only prints after the …

Member Avatar
Member Avatar
+0 forum 19

I'm an absolute beginner. I needed help in creating a "loop"(idk if that's what it would be called). Basically I want to know how I can make a menu where I can select an option and then go back to the previous menu and creating kind of a loop somehow, idk I'm really bad at explaining. I need this only using Python and nothing else

Member Avatar
Member Avatar
+0 forum 3

Hello, Please i need help with python 2.7 i use "from string import Template" and there error with Unicode if i print the string without Template working good and if i print it under Template appear error ""AH01215: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 8: ordinal not in range(128)"" my example : 2 files index.py template.py in "template.py" file i use this code #!/usr/bin/python # -*- coding: utf-8 -*- ######################################################## # from string import Template ABC = Template("""<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> Hello ${NAME}""") and in index.py file i use this code #!/usr/bin/python # -*- coding: utf-8 -*- …

Member Avatar
Member Avatar
+0 forum 2

MyMainWindow::createUI() { label = new QLabel("foo"); button = new QPushButton("Browse"); connect(button, SIGNAL(clicked()), SLOT(browse())); layout = new QHorizontalLayout(); layout->addWidget(label); layout->addWidget(button); setLayout(layout); } void MyMainWindow::browse() { QString directory = QFileDialog::getExistingDirectory(this, tr("Find Files"), QDir::currentPath()); if (!directory.isEmpty()) { if (directoryComboBox->findText(directory) == -1) directoryComboBox->addItem(directory); directoryComboBox->setCurrentIndex(directoryComboBox->findText(directory)); } } MyMainWindow::createUI() { label = new QLabel("foo"); button = new QPushButton("Browse"); connect(button, SIGNAL(clicked()), SLOT(browse())); layout = new QHorizontalLayout(); layout->addWidget(label); layout->addWidget(button); setLayout(layout); } void MyMainWindow::browse() { QString directory = QFileDialog::getExistingDirectory(this, tr("Find Files"), QDir::currentPath()); if (!directory.isEmpty()) { if (directoryComboBox->findText(directory) == -1) directoryComboBox->addItem(directory); directoryComboBox->setCurrentIndex(directoryComboBox->findText(directory)); } }

Member Avatar
Member Avatar
+1 forum 1

.

Member Avatar
Member Avatar
+0 forum 1

hi there i have some python coding which i need to convert to java can ne1 help me please email me back if you can help then i will show you the coding much appriciated

Member Avatar
Member Avatar
+0 forum 9

The purpose of this assignment is to provide you with experience in coding programs that make use of parallel lists. This program maintains 2 parallel lists. The first list maintains names of students and the second list maintains their grades. These 2 parallel lists are shown below: Elements in parallel lists are processed as a pair. For example, the student whose name is maintained in the 1st element in the lst_stu_names list has a grade that is the first element in the lst_stu_grades list. The subscripts used to access the elements in the list are also shown in the graphic. …

Member Avatar
Member Avatar
+0 forum 1

Hello, I am new to Python. I am learning boxsizer. I want to put two buttons on my panel. One at top right corner and one at bottom right corner. How do I achieve this? Thanks

Member Avatar
Member Avatar
+0 forum 4

I have scoured Stack over flow and the Pandas documentation for a solution to this issue. I am attempting to recursively move through a directory and concatenate all of the headers and their respective row values. Below is what I have so far after much experimentation with other libraries: import pandas as pd import csv import glob import os path = '.' files_in_dir = [f for f in os.listdir(path) if f.endswith('csv')] for filenames in files_in_dir: df = pd.read_csv(filenames) df.to_csv('out.csv', mode='a') However all of the headers and their corresponding values are stacked upon each other. In addition, the files' headers and …

Member Avatar
Member Avatar
+0 forum 3

Just trying to find out which of these five isprime functions is the fastest.

Member Avatar
Member Avatar
+1 forum 7

I have to convert a piece of C++ code to Python. Except I can't understand what it's doing. This is the code: [CODE]#include <iostream> using namespace std; int calculate(int values[], int size) { int answer = 0; for (int 1 =0; i< size; i +=1) } answer += values[1]; } return answer; } int main() { int myArray[5] = {0, 2, 4, 8, 16}; count << "The answer is " << calculate(myArray, 5); }[/CODE] This is my attempt at converting it to Python: [CODE]def main(): myArray[5] = (0, 2, 4, 8, 16) print "The answer is ", calculate(myArray, 5) def …

Member Avatar
Member Avatar
+0 forum 16

This is a program to get a student mark, as an input from user and print its grade based on the following criteria: if mark>=80 print 'A' if mark between 70-80 print 'B' if mark between 60-70 print 'C' if mark between 50-60 print 'D' if mark < 50 print 'F' How do I fix this code when e.g someone gets 75 it says you got a B C D ? percent = 85 if percent > 80: print("You got an A!") if percent > 70: print("You got a B!") if (percent >60): print("You got a C!") if (percent > …

Member Avatar
Member Avatar
+0 forum 4

I am currently building a LSTM model to predict only the daily Open price of a stock. Is there a difference in the prediction of the Opening price if I include other parallel series (High, Low, Close, technical indicators etc) using a Multiple Parallel Series Model compared to using a univariate LSTM only on Open prices? In other words, a Multiple Parallel Series LSTM with N series, just runs N different univariate LSTMs? Thank you in advance! The code for Multiple Parallel Series LSTM is from this tutorial: https://machinelearningmastery.com/how-to-develop-lstm-models-for-time-series-forecasting/

Member Avatar
Member Avatar
+0 forum 1

I interpolated temperature data observed on an urban area formed by 12 locations. Now i would like to remove all interpolated values that are outside the shapefile layer. How can i do it? The shapefile links: https://www.dropbox.com/s/0u76k3yegvr09sx/LimiteAMG.shp?dl=0 https://www.dropbox.com/s/yxsmm3v2ey3ngsp/LimiteAMG.cpg?dl=0 https://www.dropbox.com/s/yx05n31dfkggbb6/LimiteAMG.dbf?dl=0 https://www.dropbox.com/s/a6nk0xczgjeen2d/LimiteAMG.prj?dl=0 https://www.dropbox.com/s/royw7s51n2f0a6x/LimiteAMG.qpj?dl=0 https://www.dropbox.com/s/7k44dcl1k5891qc/LimiteAMG.shx?dl=0 The Data is: Lat Lon T 0 20.8208 -103.4434 22.0 1 20.7019 -103.4728 21.9 2 20.6833 -103.3500 24.2 3 20.6280 -103.4261 NaN 4 20.7205 -103.3172 25.7 5 20.7355 -103.3782 24.0 6 20.6593 -103.4136 NaN 7 20.6740 -103.3842 25.0 8 20.7585 -103.3904 23.0 9 20.6230 -103.4265 NaN 10 20.6209 -103.5004 20.0 11 20.6758 -103.6439 26.8 12 20.7084 -103.3901 24.4 …

Member Avatar
Member Avatar
+0 forum 3

I am highly interested to be a **Data Scientist.** so,whats your suggestion ? How can I go ahed

Member Avatar
Member Avatar
+0 forum 2

Hey there, so i'm trying to answer this question but i'm hitting a snag. i'm not familiar with the environment so it's very difficult to understand the syntax. I would like someone to help me look through and assist with the syntax. Also how to pass the input to get desired output ![Help.PNG](/attachments/large/4/6672a9ccc30db1329cbe5d306c66b2f1.PNG)

Member Avatar
Member Avatar
+0 forum 2

***** I created the format: def main(): pennies=int(input("Enter pennies:")) nickels = int(input("Enter nickels:")) dimes = int(input("Enter dimes:")) quarters = int(input("Enter quarters:")) print("You entered:") print("\tPennies:" , pennies) print("\tNickels:" , nickels) print("\tDimes:" , dimes) print("\tQuarters:" , quarters) total_value = get_total(pennies, nickels, dimes, quarters) v_Dollars, v_Cents = divmod(total_value, 1) print("Total = ${:,.2f}".format(total_value)) print("You have {:,} dollar(s) and {:.2f} cent(s)".format(int(v_Dollars), v_Cents)) # This format from the top^ was already created from "Start the assignemnt with this file": # Completed the function for get_total: # displayed the functions for pennies, nickels, dimes, and quaters. # returning the value of the money sent to the via …

Member Avatar
Member Avatar
+0 forum 2

Hey guys, I'm in desparate need of assistance with my A-Level project. I'm writing a Banking system in Python and I'm being told by the idle log that a function hasn't been defined - even though that function is right above it! My Full Code is: #'http://effbot.org/tkinterbook/tkinter-index.htm' <<< Tkinter Tutorials #Ignore the link above, it's for future reference import time import random class BankAccount(): #Class Initialisation def __init__(self, firstName, lastName, accountNumber, pinNumber, balance=0): self.fn = firstName self.ln = lastName self.accNum = accountNumber self.pin = pinNumber self.bal = balance self.transactions = [] #Class Functions def deposit(self, amount): self.bal += amount return …

Member Avatar
Member Avatar
+0 forum 2

Hey there! I have problem with a programm of mine in pyhton. I want to find the index of the character "o" in my list. How can I find that out. Thx for your help in advanced!! s1 = [["aidl"],["utov"]]

Member Avatar
Member Avatar
+0 forum 1

Listed below is the original word jumble python program. According to the exercise i'm supposed to add hints see next thread on my modified program however it doesn't work correctly. [code=python] # Word Jumble # # The computer picks a random word then "jumbles" it # The player has to guess the original word # import random # create a sequence of words to choose from WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone") # pick one word randomly from the sequence word = random.choice(WORDS) # create a variable to use later to see if the guess is correct correct …

Member Avatar
Member Avatar
+1 forum 5

After running a python code for usb device following error is occured Traceback (most recent call last): File "test1.py", line 6, in dev = usb.core.find(idVendor=0x1d6b, idProduct=0x0001) File "/usr/lib/python2.7/site-packages/usb/core.py", line 1263, in find raise NoBackendError('No backend available') usb.core.NoBackendError: No backend available

Member Avatar
Member Avatar
+0 forum 4

i am almost done with the hangman game but i just need to migrate it to graphics i know i need to use entrybox but i still dont know. [CODE]rom graphics import* from random import * MAX_BAD_GUESSES = 7 def readfile(): infile = open("wordlist.txt","r") contents = infile.read() lines = contents.split("\n") return lines def random(lines): secret_word = randint(0,len(lines)-1) return lines[secret_word].lower() def play(secret_word): guess = 0 solution = [] for i in range(len(secret_word)): solution.append("_") num_incorrect = 0 while num_incorrect < 7 and "_" in solution: print(" ".join(solution)) guess = input("Enter a letter") if secret_word.find(guess)==-1: num_incorrect = num_incorrect +1 else: i = secret_word.find(guess) …

Member Avatar
Member Avatar
+0 forum 4

from tkinter import * import time root = Tk() root.title("Testing System") root.geometry("900x600") def main(): def tick(): time_str1= time.strftime("%H:%M:%S") clock.config(text = "Current Time:\n" + time_str1) clock.after(200, tick) def date(): date_str1 = time.strftime("%A, %d %B %Y") date2.config(text = date_str1) date2.after(200, tick) frame = Frame(root) clock = Label(frame, font = ("times", 14, "bold"), bg = "light pink") clock.place(x = 260, y = 60) tick() date2 = Label(frame, font = ("times", 13, "bold")) date2.place(x = 40, y = 560) date() button1 = Button(frame,text = "Test", height = 2, width = 10, command = frame.destroy and menu) button1.pack() button1.place(x = 370, y = 150) def …

Member Avatar
Member Avatar
+0 forum 1

The End.