15,181 Topics

Member Avatar for
Member Avatar for Judgment

I require a program that will remove all trailing whitespace (any spaces that occur at the end of a line) from a text file. It should do something like: Space Stripper Enter the name of the file to be stripped: news.txt Any help would be gladly appreciated. I'm also seeking …

Member Avatar for Namibnat
0
180
Member Avatar for andrewktmeikle

Hello, I'm having a slight problem with my code. The task is to create an indexing program, similar to the ones the google uses. The problem i'm having is that we have to remove the common ending from the words left after the removal of stop_words(which is a list variable …

Member Avatar for andrewktmeikle
0
2K
Member Avatar for Dan08

hey everyone, i am writting an app with tkinter, well ive tried quite alot of different ways but i couldnt find the solution for my problem. So, in that window there is time and i need it to constantly change, like every second. Any ideas? Thanks Dan08

Member Avatar for Dan08
0
22K
Member Avatar for hackabusa

Hi, I'm having some issues with a maze solver that I'm coding for an assignment. Here's what I have so far: [CODE] def main(): maze = open(raw_input("Please enter the filename of the maze:"),'r') x=0 y=0 with maze as maze_file: maze = [list(line.strip()) for line in maze_file] for i in maze: …

Member Avatar for hackabusa
0
139
Member Avatar for SoulMazer

Okay, well I'm having trouble getting a variable from one place to the other. I have two scripts: for now, let's call them MainScript.py and ChildScript.py. [code=python]#!/usr/bin/python # MainScript.py import ChildScript from Tkinter import * class GetVariable: def __init__(self): master = Tk() master.withdraw() ChildScript.VariableDialog(master) # From right here, I would …

Member Avatar for SoulMazer
0
141
Member Avatar for Workingwmyhands

I need help with an online tutorial (this is not homework) [url]http://www.upriss.org.uk/python/session3.html[/url] It is something very simple, but I am a beginner so I don't understand yet. Write a script that asks someone to input their first name, last name and phone number. If the user does not type at …

Member Avatar for SoulMazer
0
159
Member Avatar for ptn001

Hi, I am new to python but learned somewhat about lists, tuples, dictionaries, db and gui (just introductory stuffs), and am trying to write a program that will alllow users to input some key words to search in a report. if key words are present in the report then the …

Member Avatar for vegaseat
0
103
Member Avatar for need help!

This is some code I wrote for a music program... Any way on making it neater/more pythonic? [CODE] from Tkinter import * import pygame playlist=[] pygame.init() pygame.mixer.init() camera=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\camera1.wav") one=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\one.wav") wrong=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\wrong.wav") root=Tk() root.title("DJ Pro") def sound_play(event=None): playlist.append(wrong) wrong.play() def sound_play1(event=None): playlist.append(one) one.play() def sound_play2(event=None): playlist.append(camera) camera.play() def play_all(event=None): for ii in …

Member Avatar for need help!
0
138
Member Avatar for fuston05

i am trying to make a password system that will run another one of my programs when answered correctly. not sure how to call my main program in the password prog function. i have played w this over and over, and browsed the library and i am officially stuck. :) …

Member Avatar for fuston05
0
160
Member Avatar for rogerking

The American Heart Association (AHA) suggests that at most 30% of the calories in our diet come from fat. Although food labels give the number of calories and the amount of fat per serving, they often do not give the percentage of calories from fat. This percentage can be calculated …

Member Avatar for masterofpuppets
0
182
Member Avatar for fummy

Can someone help please! I need to search for a different set of strings like: 'fummy' or 'users' or 'logon' from a directory like this: C:\mycase\Nic..\ A Text document is stored in there LIKE: 544, Text Document, 45, 588 KB Can some help to write a script or python program …

Member Avatar for fummy
0
92
Member Avatar for jimothy

I cant get text working in my programs if I double click the icons in windows but it does work in the WinEditor. Why doesnt it work and what could I do to get text working wherever?

Member Avatar for vegaseat
-1
50
Member Avatar for Devi

First let me say I know absolutely nothing about Python. All I know for sure is that I own the PC game Vampire Bloodlines and I am getting a runtime error. I have researched online and have read that if you have an older version of Python the game will …

Member Avatar for Nick Evan
0
361
Member Avatar for richirich007

Hello I an new to python I want to write a function which save the contents to disk I am using GTK also to design . On clicking the save menu item the output should be able to saved at any desired location {on_save_activate()}. Please help me to write the …

Member Avatar for MSV22
0
65
Member Avatar for ShadyTyrant

Hello fellow python programmers. I had an idea the other night when watching a video on the creation of the Tasque application. Developers at novel are given a week called "Hack week" were they have no management and are allowed to code anything they like. Well two of the developers …

Member Avatar for Gribouillis
0
356
Member Avatar for etypaldo

I am making a game using pygame and livewires. I am having trouble with the scoreboard- it updates appropriately but does not delete the old scoreboard, thus creating a blob of numbers: [CODE]class Ship(games.Sprite): """Ship, represents the player""" image = games.load_image("ship.bmp") DELAY = 25 def __init__(self, x, y): super(Ship, self).__init__(image …

Member Avatar for tbone2sk
0
239
Member Avatar for Dokino

hello, I've wrote this calculator [code=python] from __future__ import division class num: x = input ("Input first number:\n") numb = num() class wtd:#wtd= what to do command = raw_input("What do you want to do?\nadd +\nsubstract -\ndivide /\nmultiply *\n") cmd1 = wtd() bull1 = cmd1.command while cmd1.command != "+" and cmd1.command …

Member Avatar for woooee
0
97
Member Avatar for lewashby

In the following program, why is [COLOR="red"]"Ac"[/COLOR] the first thing that the program outputs? In main, [COLOR="red"]print "Printing a Card Object"[/COLOR] is the first think I see that should print anything. Is it the [COLOR="red"]__str__[/COLOR] method using the rank & suit attributes from the [COLOR="red"]__init__[/COLOR] constructor? [CODE]# Playing Cards # …

Member Avatar for snippsat
0
393
Member Avatar for ffs82defxp

this is my code: [CODE]import os,sys import random import webbrowser import time import subprocess as sp cls=os.system("cls") title=os.system('title Hit any key to start searhing!') while True: cls print "" title raw_input() getRandEntry() def getRandEntry(): theFile = open("wordlist.txt","r") wordList = theFile.readlines() theRandoms = [] theRandoms.append(random.choice(wordList)) * 4 startLink(theRandoms) return theRandoms def …

Member Avatar for Gribouillis
0
168
Member Avatar for axa121

Hi, I am still very new to python and programming so could anyone help me on how to input lines from a user, one line at a time until they type "." on a separate line. I also wanted to count how many lines they entered. What I tried was …

Member Avatar for masterofpuppets
0
185
Member Avatar for sentinel123

hey folks, i'm trying myself on a csv based adressbook but I get the following error: [CODE] Traceback (most recent call last): File "C:\Dokumente und Einstellungen\Mo\Desktop\adressbook.py", line 11, in <module> writer.writerows(data) File "C:\Python26\lib\csv.py", line 149, in writerows rows.append(self._dict_to_list(rowdict)) File "C:\Python26\lib\csv.py", line 140, in _dict_to_list ", ".join(wrong_fields)) ValueError: dict contains fields …

Member Avatar for J-M DESMETTRE
0
773
Member Avatar for AlexandreS

I'm having difficulties parsing filepaths sent as arguments: If I type: [code]os.path.normpath('D:\Data2\090925')[/code] I get [code]'D:\\Data2\x0090925'[/code] 0bviously the \0 in the folder name is upsetting the formatting. I can correct it with the following: [code]os.path.normpath(r'D:\Data2\090925')[/code] which gives [code]'D:\\Data2\\090925'[/code] My problem is, how do I achieve the same result with sys.argv, namely: …

Member Avatar for AlexandreS
0
135
Member Avatar for theweirdone

Hi, I'm trying to get a list of the subjects that I'm getting from emails in gmail. I can get the subjects, but I can't seem to get them into a list. Here's my code so far: [CODE] #! usr/bin/env python import imaplib M=imaplib.IMAP4_SSL('imap.gmail.com', 993) M.login('user@gmail.com','password') M.select() typ, emails = …

Member Avatar for slate
0
134
Member Avatar for gangster88

I need the function to be able to walk in all four directions with equal probabbility and return the distance away from the starting point. The function below only takes steps forwards and backwards? [code] def main(): numWalks, numSteps = getInputs() averageSteps = takeWalks(numWalks, numSteps) printExpectedDistance(averageSteps) def getInputs(): numWalks = …

Member Avatar for thecheesewheel
0
104
Member Avatar for sentinel123

hi guys is there a way to refer to every 2nd symbol of a string? example: [CODE] mystring = 'bananasplit' [/CODE] i want to refer to every 2nd and every 3rd symbol of any string the user types in. in this case the 1st symbol is 'b', the 2nd is …

Member Avatar for sentinel123
-2
4K
Member Avatar for d8m9

Hi, Iam new in python (1/2year) and here is the thing: I made a small text editor with tkinter and I want to generate web page from the text editor (from formated text). To web page generating I will use the HTMLgen module. So it must be created another python …

Member Avatar for d8m9
0
181
Member Avatar for funfullson

I wrote a gui with qt and converted it into python.it came below. know I want to use the information witch user entered.for example the text boxes text or want decide around the buttons clicked or any thing else.at all how can i manage my qt forms data in my …

Member Avatar for funfullson
0
140
Member Avatar for Inkoosikas

Hay, I am a noob, to the programing world, so i need a little help with lists. My problem is; I would like to create a list that contains the percent that each number of the first list is of sum of the firs list list. so like this. [CODE]first_list=[1,2,3,4,5] …

Member Avatar for Inkoosikas
0
98
Member Avatar for Dmc15

Im trying to create a python program capable of solving a maze. I need it to be able to solve a maze that is any number of rows in height and any number of columns in width. I need the maze itself to be brought in as input from a …

Member Avatar for slate
0
197
Member Avatar for klackey19

This program is supposed to add, subtract, multiply, and divide complex numbers and doubles as well as complex numbers against complex numbers. When i try to run it, I get a syntax error at line 59 and cannot figure out why. Any help/advice/pointers would be greatly appreciated. [CODE]class complex: def …

Member Avatar for woooee
0
104

The End.