15,175 Topics
| |
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 ! | |
I can't get the math to work in this program. The 'coinflip' flips a coin until it finds either the sequence heads-tails-tails or heads-tails-heads. My issue is that when I run it, the program will perform way more trials than told, and will only account for a random few in … | |
Hi All, I've got a problem with the python class. I want to create a list of object of type obj() and link them such that the next of one object is the next in its place order. I tried this construction [code] class obj: ------def __init__(self,cargo=None,next=None): ---------------self.next = next … | |
How do you call a method from the main() from a module to print base class attributes. Objects are contained in a list. Module [CODE] def show_employee(self): print 'Employee Name: ', self.__employee_name print 'Employee Number: ', self.__employee_number [/CODE] | |
Basically i'm creating a software to calculate the shorting distance between two graphs. I use dictionarys to organize this information I sort the path's as keys , each key has different paths according to the given inputs through the command: PrintByDistance. The inputs are made through the command: `insert:company:City1:City2:Distance` Company … | |
Hello, I' ve been having the following problem: - my OS is Centos - I have python 2.4 installed (and several packages in it too, like yum, ...) - I have installed python 2.6 - I have taken out all python2.4 executable references in usr/lib so that only python 2.6 … | |
Hello i'm rather new to Python and I was wondering how I could do a menu to prompt the user to choose a number and execute a certain part of code based on his choice. For example: please choose an option 1) 2) 3) then based on users input, it … |
The End.