15,185 Topics

Member Avatar for
Member Avatar for Thisisnotanid

Hi everyone! I've built prime testers and prime listers before, but they only work sufficiently fast for values <= 1e6. I was thinking about all the prime tester projects they have going on, how do they test very large numbers for primality? I'm talking numbers on the order 1e12, 1e13, …

Member Avatar for Thisisnotanid
0
570
Member Avatar for hughesadam_87

Hey guys, I've been trying to solve this problem many ways now, and am really just not familiar enough with the language to see an elegant solution. I have a dictionary, where each value is itself a list of lists. For example: [CODE]keyA:([x1,y1,z1], [x2,y2,z2] etc...) [/CODE] Within a key, I …

Member Avatar for djidjadji
0
374
Member Avatar for LogicallyInsane

Is there any way to replace certain parts in a string of text with different text? Like this: [code=python]# This is not a functioning code, the actual meaning is totally different from what I'm trying to depict text = 'This is a line of text' print text # shows "This …

Member Avatar for vegaseat
0
117
Member Avatar for nooony

I've been learning python during one semester, and pygame in one week... Im making a simple kid guessing game where random images appear with one word. click on the correct image that the word describes and a little green right image appears and a red cross 'wrong' if it is …

Member Avatar for nooony
0
485
Member Avatar for bxsciencer

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 …

0
32
Member Avatar for night_guard

[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?

Member Avatar for Gribouillis
0
181
Member Avatar for nutrion

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 …

Member Avatar for nutrion
0
146
Member Avatar for dbphydb

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 …

Member Avatar for richieking
0
374
Member Avatar for hisan

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.

Member Avatar for hisan
0
168
Member Avatar for felix001

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

Member Avatar for griswolf
0
137
Member Avatar for novice20

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...

Member Avatar for novice20
0
124
Member Avatar for raden1

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 …

Member Avatar for ultimatebuster
0
135
Member Avatar for vbx_wx

[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.

Member Avatar for vbx_wx
0
91
Member Avatar for dbphydb

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 …

Member Avatar for woooee
0
177
Member Avatar for seanbp

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]

Member Avatar for griswolf
0
92
Member Avatar for thekitoper

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 …

Member Avatar for thekitoper
0
1K
Member Avatar for techie1991

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 …

0
114
Member Avatar for felix001

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 …

Member Avatar for TrustyTony
0
112
Member Avatar for twohot

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 …

Member Avatar for twohot
0
130
Member Avatar for sravi.pearl

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.

Member Avatar for richieking
0
2K
Member Avatar for ultimatebuster

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?

0
81
Member Avatar for Gh0st93

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 …

Member Avatar for Gh0st93
0
172
Member Avatar for leazell

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 …

Member Avatar for Thisisnotanid
0
6K
Member Avatar for Simplicity.

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 …

Member Avatar for Simplicity.
0
244
Member Avatar for Syphilis

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 …

0
64
Member Avatar for felix001

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 …

Member Avatar for shibby
0
2K
Member Avatar for Thisisnotanid

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 …

Member Avatar for Thisisnotanid
0
2K
Member Avatar for mcenley

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 …

Member Avatar for vegaseat
0
3K
Member Avatar for radc

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 …

Member Avatar for richieking
0
655
Member Avatar for TrustyTony

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.

Member Avatar for TrustyTony
0
218

The End.