15,175 Topics

Member Avatar for
Member Avatar for fatima_7

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?

Member Avatar for JamesCherrill
0
561
Member Avatar for Kim Gabrielle

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 …

Member Avatar for Kim Gabrielle
0
784
Member Avatar for nadiam

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") …

Member Avatar for woooee
0
337
Member Avatar for nadiam

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 …

Member Avatar for nadiam
0
390
Member Avatar for random_1

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 …

0
190
Member Avatar for wai hoong

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 …

0
159
Member Avatar for mat_2

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, …

Member Avatar for rproffitt
0
420
Member Avatar for Elizabeth_13

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 …

Member Avatar for Reverend Jim
0
1K
Member Avatar for jrcagle

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 …

Member Avatar for Jiten_1
-1
6K
Member Avatar for Fo.katia

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 …

Member Avatar for woooee
0
13K
Member Avatar for Gunjan_5

# 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)

0
181
Member Avatar for Chandrai

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 …

0
149
Member Avatar for Tony_9

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 …

Member Avatar for Ankush_4
0
13K
Member Avatar for random_1

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 …

Member Avatar for random_1
0
3K
Member Avatar for Eashan

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.

0
151
Member Avatar for Eashan

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)

Member Avatar for woooee
0
455
Member Avatar for Eashan

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 = …

Member Avatar for woooee
0
422
Member Avatar for Rj_1

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 …

Member Avatar for Nathan_13
0
195
Member Avatar for massivefermion

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 …

0
178
Member Avatar for ALosh99

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 …

Member Avatar for ALosh99
0
355
Member Avatar for nadiam

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: …

Member Avatar for nadiam
0
373
Member Avatar for RafaelNinja13

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 …

Member Avatar for woooee
0
2K
Member Avatar for Wookzy

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 …

Member Avatar for mattrweaver
0
2K
Member Avatar for mattrweaver

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 …

0
145
Member Avatar for massivefermion

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

Member Avatar for rproffitt
0
328
Member Avatar for sahilmohile15

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 …

Member Avatar for JasonHippy
0
301
Member Avatar for Ashwini_6

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)

Member Avatar for sahilmohile15
0
207
Member Avatar for srinivasa reddy_1

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')

Member Avatar for woooee
0
328
Member Avatar for Toddh86

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 …

Member Avatar for rproffitt
0
292
Member Avatar for bharathsharma

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 …

Member Avatar for gdtraveller
0
443

The End.