15,190 Topics
![]() | |
I get the following error from running this code. Was wondering if 'i' and 'j' are considered objects. If yes is there any way i could cast them..... How do i write a better for loop for this.... array2D = [[0 for i in range(10)]for j in range(10)] for i … | |
[ . *&k*. " '*&e* ' " '*'" &k&k&k "*' ' ' *, ] I received this text from a man I have been on a few dates with and have no idea it means?? ANY help would be greatly appreciated!! | |
I am trying to find the position of the maximum number in a 2D array. i have used .max() to find the max value but how do i find its position? | |
Using the tutorial found here: [url]http://www.daniweb.com/code/snippet216550.html[/url], I have begun the graphic portion of my game. I have many .gif battler sprites loaded into variables in my project. However, all of these battlers are right-facing. I need some of them to be flipped to be left-facing to be on the hero's … | |
Hello all, I am building a web application in python that prompts the user for a question that they want to have answered, then gives multiple answers by querying various Q&A sites (yahoo! answers, chacha, answerbag, etc). The problem is, I'm having trouble finding a significant number of APIs from … | |
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, … | |
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 … | |
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 … | |
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 … | |
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 … |
The End.