15,181 Topics
| |
Does anyone have the code and test vectors to CRC-24 Radix64 (from RFC4880)? Either the code i have is wrong, or I dont know how to input the data. i cant seem to find a source code from other programs. is this code even correct? [CODE]def CRC24(octets): # octets is … | |
[code] class x(object): def __init__(self): self.x=1 class y(x): def __init__(self): super(y, self).__init__() [/code] what is it doing "super" function in here? | |
All, I have the following that I'm trying to write: [CODE] mac = open("maclisting.txt","a") tn = telnetlib.Telnet(HOST) tn.read_until(b"Username: ") tn.write(b"xxxx\n") tn.read_until(b"Password: ") tn.write(b"xxxx\n") tn.read_until(b"#", 5) tn.write(b"term leng 0\n") tn.read_until(b"#", 5) tn.write(b"sh arp\n") tn.write(b"exit\n") results = (tn.read_all().decode('ascii').split("\n")) for line in results: if len(line) > 40: print(line,) mac.write(line,) else: continue [/CODE] The … | |
Hey all, I am basically a QA tester. To ease some process, i need to download 2 files from some server and calculate the time taken to download each file. 1. The file names are constant 2. The location from where i want to download these files is constant Can … | |
Hello ALL, I need to capture the HTTP requests that are sent from my web application, using Selenium and python please help me in achieving this. | |
I currently have an XML (pasted below) that I want to place into a dictonary. With each dictonary key being the content of the XML`s <TITLE> markup and the values containing the content of the XML`s <ARTISTS*> markup. [CODE]<EXAMPLE> <CD> <TITLE>TITLE1</TITLE> <ARTIST1>ARTIST-ABC</ARTIST1> <ARTIST2>ARTIST-DEF</ARTIST2> </CD> <CD> <TITLE>TITLE2</TITLE> <ARTIST1>ARTIST-XYZ</ARTIST1> </CD> <CD> <TITLE>TITLE3</TITLE> … | |
can anyone suggest a simple method to define an enum in python. as some examples floating on net, i used class Animal: DOG=1 CAT=2 print Animal.DOG but it doesn't seem to be working... | |
I am making a simple python game. I would like to be able to restart the game based on user input. You have a certain amount of guesses to guess which way to coin falls. If you lose you would get the option of restarting, instead of just breaking the … | |
[code] lis.py class mylist: def __init__(self,l): self.data = l; def __add__(self,l): self.data = self.data + l def __repr__(self): return self.data main.py from lis import* x = mylist([1,2,3]) x = x + [4,5] print x [/code] Why is it printing None? What do I did wrong,Thanks. | |
Hi, I have the below script which downloads few files from server and writes the file size, start time and download time to a file. Now i want a header for that file. The script does so, but when i run the script again, again the header is appended to … | |
I'm assuming there's no easier way to do this. Is thread locking really automatic? Am I misreading the documentation? [CODE]from threading import Thread make_thread = lambda fn, *args: Thread(None, fn, None, args).start() def my_fn(*args): for arg in args: print (arg) make_thread(my_fn, "toaster", "ovens") [/CODE] | |
I am still quite a newbie with python so my code Is quite sloppy. Whenever I run it I get an error reading "Surfaces must not be locked during blit" but in my code I did not purposely lock the surface please help thank you. Here is my code: import … | |
I just wanted to learn to create facebook applications using python.I am new to web development of any sorts, so everything seems to be weird right now. Here is what i acquired by google searching pages: This is the facebook developers page: [url]http://developers.facebook.com/opensource/[/url] Only one link to python.. [url]https://github.com/facebook/python-sdk[/url] The … | |
Im pretty new to Python, so i apologise in advance. My main goal is to parse a csv file (as per below) and to create a list named based on column 5 which includes values from column 7 as the elements. 01/11/2010,DEB,12345,12345,CREDIT CARD,,44 01/11/2010,DEB,12345,12345,TAKE AWAY,,20 01/11/2010,DEB,12345,12345,TAKE AWAY,,22 01/11/2010,DEB,12345,12345,TAKE AWAY,,24 The … | |
I have spent 4hrs+ trying to figure out why I can't catch an IOError. Most of the solutions I find, seem to be python-2 specific. I'm using python-3. Take a look at this: [code]def getfile(cfg): try: with open(cfg, 'r', encoding='utf-8') as tmp_file: tmp = tmp_file.read().strip().split('') except IOError as err: print … | |
Can any one please tell me how to display the result in notepad For Example My code : import urllib a = urllib.urlopen("https://www.google.com") Source = a.read() a.close() print Source raw_input("*************Press Enter to Exit****************"); i have to display the result of it in a note pad. | |
I currently have Win7 64bit installed. I know it's possible to install python 32bit, GTK32bit and PyGTK 32bit and use it, but is there a way to get python 64bit, gtk 64 bit, and pygtk64 bit working on 2.6.6 without compiling myself? | |
I was running a game I wrote in python with pygame on my Mac 10.6 machine and I notice this Warning. "Warning once: This application, or a library it uses, is using NSQuickDrawView, which has been deprecated. Apps should cease use of QuickDraw and move to Quartz." So does anyone … | |
I am trying to create a simple recursive prime number function. I am not sure why this is not working. I originally was using remainder division but changed it to integer division. **** if n ==0: # This runs infinitely, The recursive call does not seem to roll down. Output … | |
I'm working on a python code to solve a PDE (Partial Differential Equation) backward in time (i.e. from t = T to t = 0.0). The code is made up of two functions: the first function ([COLOR="Red"]def Solve_for_U_values_at_Time_T()[/COLOR]) solves a PDE (PDE1) forward in time, and returns an array of … | |
Greetings! So if I wanted to open a PE executable file whilst on Windows and add a text resource to it, how could I do that in Python? I've asked this question before on another website and got the answer 'using the pefile module' however it has poor documentation and … | |
Im pretty new to python and am trying to right a small script.... [CODE]#!/usr/bin/python import csv import string itemlist = [] reader = csv.reader(open("statement.csv", "rb")) for row in reader: item = row[4] itemlist.append(item) itemlist = list(set(itemlist))[/CODE] Every time I run it though I get the error : [CODE]Traceback (most recent … | |
Hi everyone. I was trying to solve Pb 35 on Project Euler ([url]http://projecteuler.net/index.php?section=problems&id=35[/url]). It essentially asks to write a program to list all circular primes under 1e6. I wrote the program and it works well for the most part. However, in the end it seems not to be able to … | |
Hi friends, I am trying to write a program for drawing a Koch curve in Python. The Pseduocode is given as follows and the hint is to use recursion: [I] To draw and Koch curve with length 'x' all you have to do is: 1. Draw Koch curve with length … | |
I am new to wx.Python and I am stack. Is it possible to put wx.Check into wx.StaticBox?? I have found some examples with Radiobuttons inside wx.StaticBox. In short window displays an wx.ListCtrl box on the left, and some check boxes and wx.StaticText arranges into wx.StaticBox on the right. But the … | |
With this code you can explore the functions of math module interactively seeing the docstrings automatically for each function. EDIT: The docstring was unfortunately from old code, this version copes with values like 'e' and multiple parameter functions. | |
I am attempting to read the access log for squid and store the last position read so it does not have to reread the file. I am running into many problems with my current code for it. I was wondering if you can help me write a more efficient code … | |
I always had stumbled on this topic, but, well, yeah. I want to learn how to combine if statements. I made a thread like this long ago, but I don't want to necropost. So, As an example, what exactly would I do if I had something like this? [code=python]def add_n(): … | |
I'm looking for ways to create variables in python3 as needed. E.g book1 = book(name1) # book is a class book2 = book(name2) book3 = book(name3) book4 = book(name4) book5 = book(name5) : : : V book-n = book(name-n) I have the names of the book in a list but … | |
hey ... im a new member of this community i have started developing python scripts for my phone i made a voice messenger for laptop using pyaudio in python and using sockets to transfer data [CODE] self.pin=pyaudio.PyAudio() streamin=self.pin.open(format=self.format, channels=self.channels, rate=self.rate, output = True, frames_per_buffer = chunk) global wf while 1: … |
The End.