15,175 Topics

Member Avatar for
Member Avatar for smerny

[CODE] for line in infile: if(line[len(line)-1:] = "\n"): line = line[:len(line)-1] output = "Searching for: " + line search.append([line,output])[/CODE] Giving me the error: [QUOTE] if(line[len(line)-1:] = "\n"): ^ SyntaxError: invalid syntax[/QUOTE] I'm basically trying to take each line of the file and I want to exclude the newline character at …

Member Avatar for vegaseat
0
162
Member Avatar for chico2009

Hi All I am working on the project detailed below and need some help please. The flow diagram is the best I could do, I'm afraid. I need some direction as to what function to use to undertake the pointing to various lines of text and also the instruction to …

Member Avatar for jice
0
161
Member Avatar for squareff255

Sorry guys! Last time I posted, I didn't know about code tags! I put them in. SO, I'm trying to write a python program that guesses a number that the user chooses between 1 and 1000 in no more than 10 guesses and I can not figure it out for …

Member Avatar for JasonHippy
0
147
Member Avatar for jtabak2

I am new-ish to python and need to write a short program which will take a file with many lines of sets of coordinates alongside a defined variable of a series of letters and out a 3 columned file with columns x, y, and letter. the input file has each …

Member Avatar for jice
0
154
Member Avatar for sysenm

Hi All! I am VERY NEW to Python and I am trying to make a program that can generate random words from a list of letters given to it. The command line can be: [I]program.py abcdefghi[/I] and then as a result the program will print all possible 9 letter words. …

Member Avatar for sysenm
0
100
Member Avatar for klabak85

Hi all, A question for you. I have these types of files at my work (.sj extension) that I need to work with and I'm wondering if there is a way to read from the file like a text file (the .sj files can be opened / read by notepad). …

Member Avatar for jlm699
0
129
Member Avatar for god0fgod

I've created a few functions to be used with pygame which are based on anti-aliased curves. At the moment and likely forever, it has two useful functions: aacircle(s,x,y,r,colour): Draws an anti-aliased circle on the surface s at the starting point x and y with the radius r. The circle will …

0
761
Member Avatar for erckle

Sorry guys...this is probably really trivial but i'm new to Python. How do you remove the first digit from a five digit number called x and then add this new number to the original x. I need to be able to remove any of the digits and add the new …

Member Avatar for leegeorg07
0
4K
Member Avatar for vextorspace

Hello, I am trying to compile a working opengl project into an executable for windows. I ran into several import issues in the python imaging library, Numeric, and OpenGL. I managed to resolve all but the OpenGL ones. There is quite a bit of conflicting info on the subject out …

Member Avatar for vextorspace
0
173
Member Avatar for patto78

Hi, The following code (BLOCK 1) is intended to simulate a television by creating it as an object, and is it stands I am pretty happy with it. Having created a volume control however, I then wanted to add a brightness and contrast control. My first attempt at doing this …

Member Avatar for Mathhax0r
0
69
Member Avatar for luiss

Hello all, I recently started using Python to test a Bluetooth Push application prototype and everything was working great until threading. I wonder if someone knows how to start multiple threads of connectpush() with Obexftp running under Linux? So far with the code below I have to wait until the …

0
166
Member Avatar for OneDreamCloser

hi all, i have a file that contains the following data (just a sample) : [code]501 0 0.932 0.933 0.931 0.931 0.929 0.933 0.93 0.928 501 1 0.974 0.98 0.978 0.976 0.974 0.974 501 2 0.953 0.949 0.944 0.951 0.942 0.942 0.942 0.948 501 3 0.933 0.934 0.934 0.935 0.931 …

Member Avatar for OneDreamCloser
0
160
Member Avatar for A_Dubbs

I am having a little trouble grasping this subject in my book. The book gives the program : [CODE]def main(): fname = raw_input("Enter filename: ") infile = open(fname, 'r') data = infile.read() print data main()[/CODE] "as a program that prints the contentsof a file to the screen using the read …

Member Avatar for vegaseat
0
71
Member Avatar for s.praneeth

Write a unit conversion program that asks the user to identify the unit from which they want to convert and the unit to which they want to convert. Legal units are inches, feet, miles, millimetres, centimetres, meters, and kilometres. Convert from? Inches Convert to? Millimetres Value? 10 10 in = …

Member Avatar for jlm699
0
337
Member Avatar for chico2009

Hi folks I have just completed my first programme with help from yourselves. I cant understand why the code , if x ==1 or 2, wouldn't work in my programme below [code=python] # Convert C to F or F to C and return with result select = True while select: …

Member Avatar for chico2009
0
183
Member Avatar for jeffsmessus

I am new to programing and am impressed with the ease of python/wxpython. I have written useful wx programs to enter data into MySQL databases, but am stuck on making a useful wxpython MySQL query progam. I have had success writing query apps in python. I'm hoping to find a …

Member Avatar for jeffsmessus
0
890
Member Avatar for alex-VX

is there any way to disable a loop when the user is inactive / when the screen saver is on?

Member Avatar for alex-VX
0
104
Member Avatar for s.praneeth

Two up is a historically popular Australian gambling game ([url]http://en.wikipedia.org/wiki/Two-up[/url]) Two up was played at Crown Casino for a time with the following rules: •Spinner nominates “heads” or “tails” •If the spinner nominates “heads” and spins a series of three heads before being eliminated he/she is paid at odds of …

Member Avatar for lllllIllIlllI
0
201
Member Avatar for blueness25

Hello, I know this is a very simple problem, but I am about to give up... Why couldn't I get the control keys do their job? Maybe someone whose eyes are more rested than mine can tell me. I will appreciate any help. I am dealing with pygame, and I …

Member Avatar for blueness25
0
803
Member Avatar for DrakeMagi

Just want to create a flexible desktop that is independent from system. For my linux system. Like to have Clean Window and Transparent. 1. Looking for the basic on Xlib. Most of what i found is unclear where i start. I like to start simple and expand. a. Want to …

Member Avatar for DrakeMagi
0
435
Member Avatar for s.praneeth

Chapter 9 of your textbook (and your lecture notes) refer to a racquetball simulation program (which is attached for your reference). Make the following modifications to the program: a) Ensure that to win a game (in addition to scoring 15 points) a player must obtain a 2 point margin from …

Member Avatar for gerard4143
0
245
Member Avatar for The-IT

hello I have been doing a lot of Tkinter lately and I was wondering of there is a way i fit a scroll bar into a text wdiget using the .grid() method. right now the code i have writen is: [code]from Tkinter import * root = Tk() text = Text(root) …

Member Avatar for The-IT
0
6K
Member Avatar for esash

Hello everyone.. I'm a new user of python.. I have encountered a problem while trying to find the inverse of a matrix even after importing numpy and scipy. The error is: >>> a=[[[1, 2, 3], [2, 3, 4], [3, 4, 5]], float] >>> print a [[[1, 2, 3], [2, 3, …

Member Avatar for vegaseat
0
154
Member Avatar for sgarber

Oops, bad title... Better title: Python Serial Output Works Only Conditionally Hi, I am working on having python send commands to a microcontroller via the serial port. I want to write a python script that will send a single byte to the serial port and then quit. The script I …

0
42
Member Avatar for simonches

Hi, I'm trying to make a program in python that solves word puzzles like this: "nj" (the answer to that is "ok") where each letter is off by one, for example a or c instead of b. the program is supposed to generate a list of possible words which will …

Member Avatar for simonches
0
157
Member Avatar for jmn0729

I would like to execute a script within a "form post" that downloads a python script. This is for the academic field, the python script is a grading script. The student must configure a case study and click a grade button (form post) that runs the python script against their …

0
72
Member Avatar for racshot65

Hello, This is driving me crazy so here it goes. I'm trying to create a program that finds the 1000th prime number. This is the code I started with to check if a number is prime: [code] numberofprimesfound = 0 numbertotest = 303 divisor = 2 if numbertotest%divisor == 0: …

Member Avatar for jlm699
0
117
Member Avatar for etypaldo

I am currently learning Python and how to work with start and stop indexing. I am doing a project from the book I am learning from and I'm stumped...I need to display a full deck of cards, with [CODE]numbers = ("A", "2", "3", "4", "5", "6", "7", "8", "9", "10", …

Member Avatar for sneekula
0
162
Member Avatar for Friktion

hey everybody i just upgraded from 2.5 to 2.6 and im having problems with building pymedia since there is no binaries out there -.- this is what im doing and getting [CODE] C:\pymedia>python setup.py build Using WINDOWS configuration... Path for OGG: ..\pymedia\libogg-1.1.4 Path for VORBIS: ..\pymedia\libvorbis-1.2.3 Path for FAAD: ..\pymedia\libfaad2 …

Member Avatar for Friktion
0
254
Member Avatar for Warkthogus

I'm attempting to write a program that will take a word entered by the user and give a concatenation of the corresponding triple quote strings. I've looked at [URL="http://www.daniweb.com/forums/thread189881.html"]http://www.daniweb.com/forums/thread189881.html[/URL], but didn't quite find the piece I'm missing. The idea is fairly simple: User inputs a word (or numbers) Exchanges letters …

Member Avatar for Warkthogus
0
219

The End.