15,181 Topics
| |
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 … | |
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 … | |
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 | |
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: … | |
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 … | |
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 … | |
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 … | |
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 … | |
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. :) … | |
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 … | |
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 … | |
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? | |
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 … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 # … | |
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 … | |
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 … | |
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 … | |
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: … | |
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 = … | |
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 = … | |
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 … | |
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 … | |
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 … | |
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] … | |
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 … | |
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 … |
The End.