15,181 Topics
| |
I've got this strange problem, I created an instance called structure, I made a function which return an object of this type. Just before returning, I print it, it gives me the right object. Now when I collect it in 'main' and print it, it becomes 'None'. If someone can … | |
So, I am supposed to be encoding and decoding hidden messages in images. I have perfect the decoding hidden messages part, but am a bit stuck on the encoding part (encoding a message by changing the red value in the pixel color to the unicode number of the letter. I … | |
Hi, I am trying to invoke a shell script from python. This shell script while running expects user inputs based on which it proceeds to perform several actions. I want to automate the process of sending the user inputs(may be from a file) I am using the subprocess Popen class … | |
I am having an issue with a project due. I am missing something? can you please help? here are the instructions and what i have so far. The final project will consist of three files called, Shape.py, Circle.py, and Square.py. I’ve written a test file you can use to see … | |
I have a list of directories named dirList. I need to filter and sort before I pickle I think. This is what I've got. [code] fileHandle = open( 'dirList.txt', 'w' ) fileHandle.write( 'yadda yadda yadda intro' ) cPickle.dump(mu1List, fileHandle) fileHandle.close() [/code] the mu1List is declared at the beginning and it … | |
This technically isn't fully a Python-related question, but I couldn't find a better place to post it than here. I'm just curious about how to get/update weather information from the internet... like say that sidebar gadget in Vista that updates the weather and temperature from some online-source. The problem is, … | |
I'm trying to get a dirList.txt file in 2 different directories to (eventually) compare them. I've got a basic start going [code] # A program to create and compare directory lists of # a music folder and its backup import os, cPickle, string, stat, fnmatch # Define variables for the … | |
Hello everyone, this time i have a question about this 2 algorithms,they are suposed to solve colisions in hash tables! Does anyone have Python Examples of Implementations ? I was given homework with this, im doing research on them, but the only language i consider myself capable of doing advanced … | |
Hi all, New to the forum here, and coding in general. I am posting because I am having a problem with a simple program intended to act as a word, character and line counter, with each counter being its own function. I keep running into the same problem over and … | |
Hi, I was just posting on the python forum when i tried posting python code and it came out weirdly. I shall show an example. This is not with any noparse or anything. And it dosent wrap it in code tags correctly. You just see the text code=python [code=python] print … | |
Hello, I need some help understanding the nonlocal variables and functions. Currently I'm reading "A byte of Python" to ease myself into the language, which so far seems to be fairly straightforward even if the syntax is a little strange coming from C++. I have copied a small script from … | |
Hi I am writing a function which gets values. These ones will be used in my sqlite query [code] def updateDB(tel, month, price): mytel = (tel,) myprice = (price,) connection = sqlite.connect("mydb.db") cursor = connection.cursor() sql = 'UPDATE mydatabase SET %s = ? WHERE number = ?' cursor.execute( sql % … | |
If I have a list of 5 random integers, is there a simple way to iterate through the list and see how many of each number there are without using 25 if/elif statements. For example my list might contain [3, 7, 10, 10, 14]. How would I determine that there … | |
I am trying to order a list containing integers. I want them sorted in numerical order from lowest to highest. I tried using sort but got the list baxk exactly as it was. [code=python] x = [5, 3, 7] x.sort print x [/CODE] What command would I usr to make … | |
Hello, I'm new nere and very much a beginner with python. I'm trying to make a blackgame program not to play but to test strategies, like I used to play this wristwatch game and always double at 12 and surrender at 17. Which is bad strategy but I swore it … | |
Hi, everybody, I just ran into a problem of running existing c-python code(python 2.5.4) from jython(version 2.5b3). Here I am trying to share the work around I find out. The idea is to make jython read [URL="http://docs.python.org/library/pickle.html"]pickle[/URL] from c-python. My c-python code reads in a xml into a class, in … | |
In python how to write a simple while loop?I am a C++ expert but i am starting to learn python. Lets say i need to write a while loop asking the user if he wants to input a number and if the user says yes, the program will input the … | |
Pardon my newbness, I only just found this site today and I have been having this problem for a bit. Background: I am using Python 2.5.2 that I recieved from a CD from my college. My OS is Windows XP, and my internet provider is Internet Explorer. Problem: When I … | |
I am rewriting a Python mechanize script to parse a site, after the entire site was altered... I am able to get part way into the pages I need to access, but have run into a bit of a problem. In the HTML below, the first segment has 2 buttons … | |
I have programed before (QuickBASIC and Macromedia Flash MX) but I am new on Python I want to create a program in which you give it a keyword and it generates a cypher. Like this: (Built in alphabet) ABCDEFGHIJKLMNOPQRSTUVWXYZ (Asks for keyword) (Lets say the keyword is BLOCK) BLOCK (Adds … | |
Before I explain what I mean in the title, I want to say that I 1) Have very little experience with python, so take anything I say with that in mind. I've only read about it, haven't really used it (although I have installed it), 2) I [B]want[/B] to learn … | |
I'm working on a simple update function to add to an existing program. It does a stat check of the source file and then copies the new file if necessary. This is easily accomplished with .py files. I've realized that I need a separate update app to delete a currently … | |
How do you write: [CODE]x = [1,2,3] for i in x: print i[/CODE] in matlab? | |
Any one know where I can find the pygame code to create a screen where you can draw simple lines by click and dragging the mouse? I know how to create lines with the pygame.draw.line(screen, (0,0, 0), (3,200), (9, 200)) script (using that as an example), but am looking for … | |
Hi there, Ive been following a pygame tutorial from devshed ([url="http://www.devshed.com/c/a/Python/A-PyGame-Working-Example-Starting-a-Game/"]here[/url] and [url="http://www.devshed.com/c/a/Python/A-PyGame-Working-Example-continued/"]here[/url]) on making a small game to helpme get to grips with using pygame unfortunately ive ran into a little snag :< I've checked and re checked the code to make sure its as given but every time … | |
Trying to make a program that displays "Harry Verderchi" 7 times using the for-loop. With the number preceding the name like: #2: Harry .... name = "Harry" name2 = "Verderchi" for i in range(8): print "#" + "i" + ": " + name + " " + name2 | |
Hi, Below is my code. Hopefully it is in the correct format. I would like to know how to ask the user the dir and file name of certain file formats (they are red in the code) and have the program take those answers and put them into the program, … | |
Hi, I've got some c++ code(which i don't have much experience in). I'm trying to write the same code again in python but i'm not having much luck. The c++ code creates an array of x,y co-ordinates: [code=c++] for (double ix = 0; ix < nlat; ix++) { for (double … | |
im doing this code and it needs the absolute value of something here is what i have so far. the formula it gives you is x = absolute value of the square root of radius squared minus the y-intercept squared. this is the bit of code i have so far … | |
I have a subclass with 4 attributes and a subclass with 3 attributes. I want to store my subclass instances in a list. Can I have one list for both of them or do I have to create another list because the number of attributes is different? Thanks ! |
The End.