15,190 Topics
![]() | |
I can't seem to figure out what's wrong with this simple code. I have a user input and if it matches prints out 'That's good', if not prints out 'Too bad' but how can I get the input to ignore being case sensitive? [code] ans=raw_input("Are you feeling well today? ") … | |
[B][/B]Hello to all. I am getting more hurdles while trying for the validation for the login from. I did a small project , but i am unable to set the validation for the main login form. I am using some simple logics. [COLOR="Green"][B]try: import os import MySQLdb,md5 import bz2 import … | |
the topic is writing/reading text files, but i got this simple question. how do i make this program so it will look like this: [url]http://i39.tinypic.com/5554wi.jpg[/url] i can't figure it out. - to make it keep looping and asking "enter your name or break to exit" continue the question until the … | |
![]() | hi again! at school we were learning about perfect numbers and i thought it would be useful to write a program to find them i currently have this code: [ICODE]b= 1 h= 1 factors = [1,] n = float(raw_input("what is the number?")) while h < n: if h*b == n: … |
Hi all, Is it possible to copy an object (instance) and manipulate the copy without affecting the original one. I mean, Suppose: D.node = 'Node' and D.child = {0:'child1',1:'child2'}. Now, copy D to D_c and put D_c.child={}. So, D should be kept as it is originaly, which means D.node = … | |
hi everyone, I am having issues with an assignment for university. I know that you are not here to do my work for me but I could really use a little help. My assignment involves a parse file that the uni tutors have written for us and we have to … | |
I just bought an inexpensive used Dell notebook that has Ubuntu/Linux as an operating system. Compared to Vista this is sweet. It came with Python25 installed, but it was easy to use the Add/Remove application feature to get open source software from the Ubuntu site. I downloaded/installed Stani's Python Editor … | |
I am printing out the R,G,B values of an image and get results like this: (30, 0, 0) (29, 0, 0) (28, 0, 0) (27, 0, 0) (26, 0, 0) (25, 0, 0) (24, 0, 6) (23, 0, 0) (22, 0, 0) (21, 0, 0) That is just a partial … | |
Hi, Don't hate me cuz I am a NUB. This may be very basic but I am more basic when it comes to python I simply need to add some variables together some come from a database and some are calculated. but I am getting a very frustrating error [code]TypeError: … | |
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 … |
The End.