15,175 Topics
| |
word="have a good day" if i want to print only this word (good) i will run this cod print(word[6:11]) why i should write 6 ? and 11? | |
Hello there. I am creating a web page using php wherein a user will login then after clicking the button, it will run the python script I made. Is it possible for the python script to run and get the user input value then save it on a variable on … | |
Hi. im trying to append a text file that is created by another class via another class which are threads. for example, i have : class AClass(QThread): def run(self): with open("Log.txt", "w") as h: h.write("Blabla \n") class BClass(QThread): def run(self): with open("Log.txt", "a") as t: t.write("new line of txt \n") … | |
Hi, i wasn't sure about the title of my question, hope its okay. Anyway, the program i have is suppose to read a binary file then find for specific bytes like this: bytes1 = bytearray(b'\x41\x64\x6F\x62\x65\x20') filename = "portrait1.dng" with open(filename, "rb") as binaryfile: with open("foundhex.txt", "w") as found: found.write("File that … | |
Im trying to find for bytes(unknown) that appear before another set of bytes that have already been found. i have a binary file that for example looks like this: 82 00 10 00 00 00 00 00 00 00 00 00 00 01 00 00 60 F8 6C 10 BF … | |
when we telnet a multi layer switch for its trace route to a specific host, I need to get router name instead of point-to-point name or IP. I would need to Write a script/program which takes the switch/router name and destination host as input. The script need to return list … | |
| Hello. I got one question, when i want to streamplot this, i got eror: "raise ValueError("The columns of 'y' must be equal")", i can't figure it out. :/ Thank you for your time. this is entire code: import matplotlib.pyplot as plt import numpy as np # discretization of domain x_start, … |
I am stuck trying to figure this out. I need to find the slope of a line after the user is prompted to click two points and display the line. I know to find slope you need y2 - y1/x2 - x1 but how can I do that if there … | |
Hi all, The continuing quest to master Tkinter has led to this implementation of the dots and boxes game. The rules are well-known: each player gets to create a new line between two dots (single-click near the line you wish to create). If a player creates a box, he gets … | |
Hello guys!! I really need your help, I'm starting to use python and I have to write a program that counts the letters of a sentence entered by the user. This is what I have so far, but I don't know why it is not working.. Please help, thank you … | |
# An orders class def __init__(self, order): # Initialise self.ID = order.order_id self.kits = [] kit = {} for x in order.kits: # Add kit kit['Type'] = x.kit_type kit['Objects'] = x.objects self.kits.append(kit) | |
INSERT [table].[Region] ([RegionID], [RegionDesc]) VALUES (1, N'East') INSERT [table].[Region] ([RegionID], [RegionDesc]) VALUES (2, N'West') INSERT [table].[Region] ([RegionID], [RegionDesc]) VALUES (3, N'North') INSERT [table].[Region] ([RegionID], [RegionDesc]) VALUES (4, N'South') I have a text file like above. From the above insert statements i want to write code so that it turns into … | |
Hello, I am new to python and try to learn more about it. How can I copy or move all the sub-folders (folderA, folderB, folderC,...) from folder1 to folder2 (folder2 is already existed)? I tried this [Click Here](http://www.daniweb.com/software-development/python/threads/176391/how-to-move-files-to-another-directory-in-python) for files and it worked. How can I use something similar to … | |
Hello. As from the topic title, i am trying to work a multithread GUI where the progress bar indicates the running process completion (like we always see when we are installing/uninstalling/downloading). I've read a couple of written tutorials and some other forums discussions regarding the progress bar and multithreading. I've … | |
Hi, how would you output the values of a foreign key. For example: if there is a table with two foreign keys (which are linked to other tables), how would you output the values of those foreign keys. | |
import tkinter root = tkinter.Tk() root.geometry("200x200") buttons=[i for i in range(10)] def getNext(): #If specific button is pressed, output "YES" for num in buttons: btn=tkinter.Button(root, text=num,command=getNext) btn.pack(side=tkinter.TOP) | |
from tkinter import* import tkinter import sqlite3 import sys conn = sqlite3.connect('REVISION CARD.db') c=conn.cursor() def load(): root=Tk() root.title("REVION CARDS") root.geometry("700x400+100+100") w1=Label(root, text="Question") w1.pack() e=Entry(root,width=40) e.pack() w2=Label(root,text="Answer") w2.pack() e1=Entry(root,width=40) e1.pack() toolbar=Frame(root) navbar=Frame(root) N=Button(toolbar, text="next",width=9,command=getNext) N.pack(side=RIGHT, padx=200, pady=5) B=Button(toolbar, text="previous", width=9) B.pack(padx=100, pady=5) toolbar.pack(side=TOP, fill=X) count=IntVar() c.execute("SELECT * FROM topic") list1 = … | |
How to add some data where ever a empty line is present. for ex. between line 3 and line 4 below, we have a empty line and I want to add some stuff at that empty line location. how can i do it please help me. I am new to … | |
In [this page](https://uwsgi.readthedocs.io/en/latest/WSGIquickstart.html), the first example of using python with uwsgi is the following code: def application(env, start_response): start_response('200 OK', [('Content-Type','text/html')]) return [b"Hello World"] As you can see, there is this `start_response` function which is provided by uwsgi, which is similar to all those things that framewroks like django provide … | |
I want to define a function like this: n_H = 0.9 # constant . x = np.array([16.7, 16.5, 16.1, 15, 13.5,14.2, 14.9, 13.7])# example to test D = np.array([0, 1, 4, 7, 16, 31, 64, 127]) Sec_nucli = [] x = [] D = [] Sec_nucli[i]= n_H *D[i]* x[i] where … | |
Hi. Sorry if the question is confusing or weird but I am trying to find a specific number of bytes after finding a different set of bytes. Hopefully with code and my explaination of code, i'll get my question across. import base64 find_bytes = bytearray(base64.b16decode('46726F4B6E6F')) with open("readfile.raw", "rb") as f: … | |
I am supposed to write a program that takes a person's whole name and returns the name's numerical value. The numerical value is found by the values of the letters in the name (with a=1, b=2...z=26). This is what I have so far: def main (): name = input("What is … | |
Hey how do you install pyHook with pip? pip installs everything for me but pyHook, when trying to install pyHook it says: Could not find a version that satisfies the requirement pyhook (from versions: ) No matching distribution found for pyhook How can i fix this? i have got windows … | |
I am trying to delete files in flask after they are downloaded, but I'm hung up on file path issues, generating empty excel files. The file that is downloaded is passed to the route for the file download from a session variable. The following code finds the file and downloads … | |
I want to associate a REST API end point to two urls, "manager" and "manager/". So I added two path entries in the urlpatterns with these urls. But it seems something that can be handled with some kind of configuration. Is there such a configuration with django? thanks | |
Hello, I am confused when we have array in python why should we use set or lists they work almost similarly right? and array are bit faster that lists. I am using numpy arrays but a friend of mine uses sets and lists. I am confused please explain what to … | |
Want to clear how to write a program to store the given telephone details in dictionary and print all the number whose name starts with e. Data =('Einstein':1234567896),('newton':2478965782),('Alexander':9876543216) | |
class subjectGradeBook(object): def __init__(self): self.grades={} def addStudents(self,name): self.grades[name]={} def reportGrade(self,name,subject,grade): k=self.grades[name] gradeList=k.setdefault(subject,[]) gradeList.append(grade) def averageGrade(self,name): k=self.grades[name] total,count=0,0 for grades in k.values(): total+=sum(k) count+=len(k) return total/count book = subjectGradeBook() book.addStudents('AlbertEinstein') book.reportGrade('AlbertEinstein', 'Math', 75) book.reportGrade('AlbertEinstein', 'Math', 65) book.reportGrade('AlbertEinstein', 'Gym', 90) book.reportGrade('AlbertEinstein', 'Gym', 95) book.averageGrade('AlbertEinstein') | |
I'm making a device that will display the weeks and days until a specific date (in this case my wifes maternity leave start). I am using a Raspberry Pi with a 4" screen. The plan is to use a python script to display full screen the weeks and days left … | |
I'm developing a GUI using wxPython (Boa Constructor IDE). My GUI has the following: Rich text control Start button Stop Button My requirement is that when I press the START button, numbers (1, 2, 3, etc.) should start printing in the text control; it should stop when I press the … |
The End.