15,175 Topics
| |
Hi everyone, I am getting a error when using Xampp with mod_python addon and another python script 1. First I entered a string in a html form and passed it to pyform.py 2.Now in pyform.py, I imported the entire simpledb.py module. 3.Simpledb.py module fetches data from mysql server. Everything till … | |
I absolutely can't figure this problem out, can anyone please help? Write a program that asks for a phrase and then calculates and displays the number of vowels in the phrase, twice. The first time, your program should calculate the number of vowels in the phrase using a for loop. … | |
Here is 2 classes: [CODE] class Test(object): def __init__(self, var1=123): self.var1 = var1 class Test2(Test): # ... [/CODE] As you can see, Test2 is an instance of Test, which has var1. var1's default value is 123. How can I change the var1 in Test2 without __init__ again? Or better yet, … | |
A demo of the Tkinter listbox widget that shows you how to create the listbox, make it scrollable, position it within a grid, load it with data from a file, select a line of data with the mouse and display it. Also, sort the lines, add a line, delete a … | |
I've realized that it would be very helpful to me to SET the mouse cursor to a particular location. Having done the usual internet searches, I can't seem to find anything on how to do it. Any ideas? (So I'm still set on converting to wx, but the project I've … | |
Dear all, Currently I am able to print out the saved values from sqlite3 database. However, I figuring out to put individual values into different text boxes.. Just like this... [img]http://i39.tinypic.com/9jnfbn.jpg[/img] Using my little experience on Java, I am thinking to use arraylist(if there is for python) and retrieve the … | |
[CODE]#WEAVING A RUG WITH PYTHON #################################################################################### ## END STRINGS## for rows in range(1): for cols in range(36): print('~', end='') print('\n') ## SEAM ## for rows in range(1): for cols in range(12): print('- -', end='') print() ## DUAL ROW DESIGN ## for rows in range(2): for cols in range(36): print('*', end='') … | |
Hi again. I want to have a file for one of my python programs, that looks something like this: [CODE]<WINDOW> #Window size 640 480 <WINDOW TITLE> App Platform Test <ICON> icon.png[/CODE] I have a function that reads each line of, and uses the data to make a window. What happens … | |
I have created a number guessing game that writes and reads scores from a text file. When a section of code was added to sort and right-align the scores from lowest to highest, a problem was encountered. This is my code: [CODE] import random print "Welcome to the Great CP1200 … | |
[CODE]list1 = [[],[],[]] list2 = [[1,2,3],[4,5,6],[7,8,9]] i = 0 j = 0 k = 0 while i < len(list1): list1[i].append(list2[j][k]) i += 1 k += 1[/CODE] I want my output for list1 to be [[1,4,7],[2,5,8],[3,6,9]]. The problem is I don't know how to advance through the lists in list2. Can … | |
Hello In my program I have a text file that I read from and write to. However, I would like to display the contents of the text file in an alligned and sorted manner. The contents currently read- name, score name, score Would I have to convert this information into … | |
im new to python. just started today. learned a few things but not much. I have made 4 different menus each with a list of choices that executes certain functions. i want to make a 4 choice menu that can direct me to each one of the other 4 menus. … | |
Hi, I am working on a project in text mining using Python. As part of the project I need to use a technical term extractor, and I found the [URL="http://www.nactem.ac.uk/software/termine/#form"]Termine[/URL] system from NACTEM very useful. I have used the web demo (it's pretty nifty) and now want to integrate it … | |
First some background, i am writing a stats program for my school, the way you enter stats is by a window that has a textbox that shows how many of that stat the player has, lets say pass thrown, and two buttons a plus and a minus to add or … | |
I have a Value Error that is caught, in the exception block when I have no problem printing to the terminal, however, i cannot insert any text into the text widget. Heres the code snippet, any ideas? try: if len( errorCode ) == 0 and len( errorCodeHex ) >= 1: … | |
[CODE=python]#Code should always be in a method or class #Always start variable names with lowercase, classes could be capital #input.upper() allows the user to use lower or upper case for each option import random def isint(x): try: int(x) return True except: return False print "Invalid guess. " def getGuessValidator(): while … | |
I have most of it but I can't figure out how to word the last part. [CODE] def findLargest(L): largest = 0 for x in L: if x > largest: largest = x return largest def findSmallest(L): smallest = 300000000 for x in L: if x < smallest: smallest = … | |
Hello! I am in the 11th grade and I have started with one of my colleagues to work on a file compression program based on Huffman coding. I have previously worked with python (a program that handles some .xls files) but this project is more complicated so I shall need … | |
Hello, I have new to programming in python(have a little experience in C++) and to this forum. I am trying to write a program that finds Nth prime number; for example the 1000th prime number. Whenever, I try to run the program I just a see a blinking cursor and … | |
Hi everyone, I am getting a error when using Xampp with mod_python addon and another python script Here is what I am trying to do, (I checked that the mysql server and apache server are running and refreshed. Also the config files was done correctly.) 1. First entered a string … | |
On the Unix machines,there is a file /usr/dict/words that contains a list of English words,one per line.This file is used by spell-checking programs for example. Write a python function which takes one argument,which is a word (as a string)and returns true if the word contains alternating vowels and consonants (i.e … | |
Hi all, I have got a regular expression of the form: "tcp:"+'[0-9]+' It works fine when using the re.search( ) module. But if I want to grep for a line in a file that contains the pattern required, then the things wont work. Grep sees the regualr expression as tcp:+[0-9]. … | |
Well I have just started learning python and one of my first projects I have assigned is to find out every uniquely usable character (like the ones in my id) can be used in python. I would save them in file. I am not very good at writing the code … | |
Hello, I found this website while I was trying to search a solution/ recipe for a problem I am trying to tackle... I am very new to python :( How can I run an executable file from a python script? for example: All the files (python script - filename.py-, executable … | |
I did a project last year in VB for image processing, basically link to a folder, load an overlay and loop through the folder overlaying a watermark. I now need to get the same thing running in python to cater for cross platform use. I have translated all the image … | |
Hi all, for the following string I want to search a pattern The string is lcpstr = "2008/03/25 log:true lcp: 78888 -> 100 lck=0 to=900 un=5840 l=0 BMN" If I take the pattern as "lcp: 78888", pattern checking is successful when I give the following statement: temp = re.search("lcp:"+" "+'[0-9]+'+" … | |
This is the question i was given --------------------------------------------------- Here is a program that prompts the user to enter a student’s marks, and then prints out whether they have passed or failed a unit. '''calculate a students grade given their final mark''' def calcFinal( asg1, asg2, exam ): final = asg1 … | |
I'm a newbie so please be patient... :) [CODE]def canvas(self): import qt self.setCaption('My Canvas') c = qtcanvas.QCanvas(self) # <- gives the canvas a parent QObject c.resize(315, 207) v = qtcanvas.QCanvasView(self) v.setGeometry(QRect(200,590,321,211)) lay = qt.QVBoxLayout(self) lay.addWidget(v) v.setCanvas(c) l = qtcanvas.QCanvasLine(c) l.setPen(qt.QPen(qt.Qt.black)) l.setPoints(10,10,390,390) l.show() v.show() c.update() l1 = qtcanvas.QCanvasLine(c) l1.setPen(qt.QPen(qt.Qt.red)) l1.setPoints(20,60,10,230) l1.show() … | |
The askdirectory window in tkinter has a fixed size. My folders are deeply nested with long names. I would like to make the window larger so one can read the entire path. (I'm in WinXP) Is there a way to set the size of the askdirectory window or make it … | |
i have 2 list contaning 4 element i must create 2 new list which contain 2 element 1st new list must contain an element from each original list 2nd list must also contain 2 element apart those of the 1st new list |
The End.