paul steven

-1

votes
5

answer
25

views

Add dictionary values stored in variable to the list python3

I am new to python. I want to add the dictionary (keys and values) to the list continuously. The list already contains some dictionary values. It should be added next to it. Any suggestions please... Here's the code: from datetime import datetime fields = {'a': 'steven', 'b': 'kumar'} timestamp = da...
Paul Steven
0

votes
0

answer
20

views

Add custom fields to JSON file based on user input from YAML file - Python3

I am new to Python. I am having the one YAML file and I am accessing it with a Python file. In YAML file, there is fields option. In YAML file, User can set variables with values. The Python file reads the variables with values and then adds it to the JSON file. Note that the variables and values ca...
Paul Steven
1

votes
1

answer
16

views

TypeError: a bytes-like object is required, not 'int' python3

I am writing a contents to JSON file. It works great in Python2 . But it fails in Python3 due to the introduction of Bytes concept. So to make it work, i converted str to bytes and converted successfully. After that, i checked the type and it was in bytes. Now python3 shows me a error again even it...
Paul Steven
-1

votes
0

answer
16

views

how to get ubuntu machine id using python

I want the get the machine id from my system by using python code. My machine id is stored in "/var/lib/dbus/machine-id" . The machine id was "556b837c93cd4b8dbd3a1c01f468d9f5" How to get the number from the file and assign it to a variable using python. Any code suggestions..
Paul Steven
1

votes
1

answer
43

views

java - recursion code explanation (check if ascending)

I am recently finished creating a program that checks if a user-inputted int array is arranged in ascending order. I have my function isAsc here: public static boolean isAsc(int[] arr, int index){ if (index==1 || arr.length==1){ return true; //Base case } else if (arr[index-2] >= arr[index-1]){ retu...
3

votes
3

answer
601

views

Java - Testing if a character array is a palindrome by means of recursion

I tried searching for solutions, but all that I have found are for strings. What I am trying to do is to check if a character array inputted by the user is a palindrome. Here's what I have so far: public static boolean palCheck(char[] a, int index, int start) { if (a[start] != a[index]){ return fals...
2

votes
0

answer
180

views

webbrowser method for webkit to retrieve attribute

I'm trying to figure a way out off the following scenario: I'm using c# to create a webbrowser for a specific use. When i'm using the webbrowser component in visual studio, i can use the following code: public void clickSubmit() { try { foreach (HtmlElement hem in WebBrowser1.document.all) { if (hem...
paul steven