15,181 Topics
| |
I'm having trouble getting this program to keep going through the lines in the first loop. It just prints out the output for the first (searchline) and stops. Can anyone help me to figure out why it won't keep reading the lines in the birthday file? [CODE] import string def … | |
I need a back-end that can: -be used in python -handle multiple-users reading and writing to a database at the same time -can be accessed on a mapped share drive I have used sqlite but I have read that it is not recommended for multi-user use. I have looked into … | |
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 my life! I know it's super beginner and there are a lot of problems, but please be … | |
Hi all, I'm fairly new to programming in Python, and I have been getting on pretty well. I had a little working program compiled from old code snippets I had found online, converted to working 3.x code and combined together with some of my own ideas to create simple apps. … | |
How can i extact the personal address from html file.. After i get the source from the html file using read() method,what pattern should i consider if i wanna extact the address? Currently i think is use the compile() method to set the matching the address' pattern, but what rule … | |
My code is: [CODE] import re import urllib import urllib2 webURL="http://www.sc.iitb.ac.in/~bijnan/personal-details.htm" #the website is connect=urllib.urlopen(webURL) #connect to this website htmlDoc=connect.read()#get the html document from this website patternIN="Permanent Address" # Where to begin to keep the text patternOUT="</tr>" # Where to end to keep the text (after the begining) keepText=False # … | |
[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 … | |
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 … | |
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 … | |
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 … | |
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. … | |
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). … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 = … | |
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: … | |
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 … | |
is there any way to disable a loop when the user is inactive / when the screen saver is on? | |
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 … | |
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 … | |
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 … | |
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 … | |
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) … | |
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, … | |
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 … |
The End.