15,181 Topics

Member Avatar for
Member Avatar for nadiam

Hello. I found this packet sniffer code that uses the pycap wrapper. Initially, its for live capture but I've changed it to read a .pcap file instead and im trying to understand it but some parts of it i can't i comprehend. could someone explain them to me please? the …

0
461
Member Avatar for Kim Gabrielle

I am making a webpage wherein I am going to ask for an input through an html form using php, and then call a python script after clicking "submit (flames)" to run and process the Flames game. Can someone help me on how to execute a python script through a …

Member Avatar for broj1
0
7K
Member Avatar for Ellena

class robot: def __init__(self, length = 20.0): self.x = 0.0 self.y = 0.0 self.orientation = 0.0 self.length = length self.steering_noise = 0.0 self.distance_noise = 0.0 self.steering_drift = 0.0 def set(self, new_x, new_y, new_orientation): self.x = float(new_x) self.y = float(new_y) self.orientation = float(new_orientation) % (2.0 * pi) def set_noise(self, new_s_noise, new_d_noise): …

Member Avatar for JamesCherrill
0
796
Member Avatar for Mamatha_1

Hi All, I have a task in Python where I need to move .csv files into a new folder. I tried using the below code but it was throwing me an error. import shutil import os source = os.listdir(r'C:\Users\mchalla\PycharmProjects\837_unzip\venv\SampleUnzipFiles\SampleZipFiles/') destination = 'C:\Users\mchalla\PycharmProjects\837_unzip\venv\SampleUnzipFiles\DelimitedFiles' for files in source: if files.endswith("_new.csv"): shutil.move(files,destination) Error …

Member Avatar for ryantroop
0
516
Member Avatar for Basel_1

Hi, i was working on a code for a vending machine and i do consider myself to be a beginner, anyway i feel my code is much longer than it needs to be and i want someone to show me a new, shorter way of presenting it. import time print …

Member Avatar for Reverend Jim
0
21K
Member Avatar for fatima_7

i dont want to know the result, i want to know the (outputs) and any other example similer to the quation to understand. A milk carton can hold 3.78 liters of milk. Each morning, a dairy farm ships cartons of milk to a local grocery store. The cost of producing …

Member Avatar for rproffitt
0
508
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
785
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
391
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

The End.