15,181 Topics
| |
Hi, I have serial data that can come in at irregular intervals from a hand held barcode scanner. The scanner continuously looks for a barcode (no button or trigger is ever pressed) and when the scanner captures a valid barcode it sends the code to the PC over serial. What … | |
I'm trying to code the game of Minesweeper. I haven't put in graphics just yet, only text labels on the buttons. Here is my create_widgets method: [code] def create_widgets(self): #Create the grid. self.square = [] self.isAMine = [] for i in range(self.y): row = [] mineRow = [] for j … | |
Hi all, I am trying to open an excel file which is in the same folder as my python script. The script is able to open the file first time, & after that it just throws the following exception: pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, u'Microsoft Office Excel', u"'test .xls' could … | |
Hello all and thanks in advance for any help you can provide. I'm new to programming in Python and am looking to put todays date parameter passed into a URL string...how would I go about accomplishing this. This is some code I've sort of been messing around with: [start code] … | |
[CODE] def dotask(): print "Task done..." def returnvalue(): return "Awesome" cmd = raw_input("Your command: ") eval(cmd + "()") [/CODE] I know that you can't use eval to assign a value to a variable. but is it the best way to have user input be performing a function? For example: I … | |
Greetings, I just want to know how to split a string using values of dictionary: dic = {'': '000', ' ': '011', 'e': '1111', 'g': '10', 'h': '010', 'o': '00', 'p': '1101', 's': '1110', 'r': '1100'} word = '1000011100001110001101010111111001110000' for items in dic.values(): [INDENT]word.split(items)[/INDENT] .... and when i do this … | |
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 … |
The End.