15,181 Topics
| |
Hi All, I am a total newbe to python. I am using some already available code to send email from commandline using my Gmail account. For the piece of code smtp = smtplib.SMTP('smtp.gmail.com', 587) I get a error ################ Traceback (most recent call last): File "Mail.py", line 44, in <module> … | |
I need to write a Python program which parses webpages and returns a dictionary of unique words and their frequenies. What I came up with was [CODE]#!/usr/bin/env python from HTMLParser import HTMLParser, HTMLParseError import urllib import urlparse import sys import os import MySQLdb import re class WordHarvester: def __init__(self): self.db … | |
Hi Is there a way to check if a float is a whole number eg 10.0, 7.0 or somthing.0 I'm doing problem 5 on project eular Mayby I have the complete wrong idea here is my code: [code] numbertobetested = 0.0 loop2 = 1 while loop2 == 1: numbertobetested = … | |
Is it possible to have a program run multiple functions at the same time? Connectionist neural network programming seems suitable for object oriented languages. But brains seem to be able to have multiple faculties working all at the same time, and in orchestra with each other. BTW I'm a complete … | |
I got first part by creating it using for loop. But got stuck on while loop. Would you see what I'm doing wrong. # Calculating number of vowels using for loop count = 0 word = raw_input("Please enter a phrase: ") for letter in word: if letter in "aeiou": count … | |
Is there any way of finding words in a 10 x 10 grid, going horizontally and vertically? For example, if i had a text file with the following in: xxxplanexx xrxxxxxxxx xexxxxxyxx xdxxxxxexx xxxxxxxlxx xxxxxxxlxx xxxxxxxoxx xxxxxxxwxx xkingxxxxx xxxxxxxxxx how would you be able to find the words red and … | |
Hello all, I'm trying use this script: [url]http://www.estamos.de/blog/2008/09/05/getting-things-done-gtd-migration-from-d-cubed-to-monkeygtd/[/url] I've tried it on my windows machine (with ActivePython installed) and on my Ubuntu machine. On both, I get this error message: File “d3tomgtd.py”, line 30, in import xml.dom.DOMImplementation ImportError: No module named DOMImplementation The script's creator seems to think that "xml" … | |
I am trying to print out a dictionary result. The dictionary is made from a database search. I have tried to print it in every possible way here is the code [CODE]#!/usr/bin/python import elementtree.ElementTree as ET import urllib import MySQLdb print "Content-type: text/html\n" info={} def find_text(element): if element.text is None: … | |
Hello, I'm writing a simple calculator in C. The main problem is I need to parse string to evaluate for example 1+2*(3-1)/2.5. However writing such parses is a very hard task. This is a trivial thing Python using this code: [code] s = raw_input('Please enter expression:') try: x = eval(s) … | |
Hello, I'm Still a python beginner. I've got this Assignment, and I think I've finished half of it. Can anyone help me out on this assignment. The codes I have done already are: [I]The assignment asks to: Make a program that prints a list of 5 items in your house … | |
Hi I've been learning python through andrew harrington's guide, but i got stuck on a problem where you enter a list (ex. ['very', 'hot' 'day'] and have the IDLE return this----> 'veryhotday'. Ive been thinking on how to do that using a for loop statement as was intstructed in the … | |
hey guys havin some problems getting to add up the check boxes ticked in python from a form.. this is my html file: [CODE]<html> <body> <form action="cgi-bin/cost.py" method="POST"> <p>Enter Name: <input name="name" type="text"/></p> <p>4 x 100-watt light bulbs for $2.39:<input name="4 100 watt" type="checkbox" value="$2.39"/></p> <p>8 x 100-watt light bulbs … | |
I have a vbs script and I'd like to convert this bit to python, It runs a macro within an excel spreadsheet and outputs 4 select lists <code> Set oExcel = CreateObject("excel.application") Var = oExcel.Run ("'I:\Data\CISSS\Resources\UserIDPassword.xls'!mymacro") </code> | |
I am writing a program that accepts a sentence and then prints out the longest line, this is what I have so far, but I am lost on what the x variable should be equal to. Any help is appreciated, thanks. sent=raw_input('Enter sentence:') splicedsent=sent.split(" ") longestword=splicedsent[0] if x in range(splicedsent[1:])>splicedsent[0]: … | |
I want to wait the song to finish after it finishes, I want to call another function How do I do that in wxpython | |
Hi, I'm new to Python and I was given an unknown (supposedly binary) to read. The problem is that I am not sure on how to real the 'actual' data. I have opened the file as: [code=python] f = open('/home/mmeclimate/test/test.dat', mode='rb') f.readline() [/code] The output from readline is: [code] 'MO00\x14\x00\x00\x00\x00\x00\x00\x00\\\x00\x00\x00\xb8\x00\x00\x00\x14\x01\x00\x00p\x01\x00\x00\xcc\x01\x00\x00(\x02\x00\x00\x86\x02\x00\x00\xe4\x02\x00\x00B\x03\x00\x00\xa0\x03\x00\x00\xfe\x03\x00\x00\\\x04\x00\x00\xba\x04\x00\x00\x18\x05\x00\x00v\x05\x00\x00\xd2\x05\x00\x00.\x06\x00\x00\x8a\x06\x00\x00\xf2\x06\x00\x00^\x07\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x05 … | |
Hello Developers, I have simple media player that have slider that runs in sync with the song. When I want to move a song on given position using slider it moves slowly with strange gagging sound while other media player like foo/win' media player when you move song to a … | |
I have simple player with wx.ListCtrl as playlist. I first Load List through open file dialog. I populate a dictionary with filenames (populated in Playlist) as keys with their path as values. When I press play, the onPlay method calls onSetPath method which looks up for selected file from list … | |
Everything seems to be well, but NOTHING GET PLAYED!!!! :oops: I have tried and tried but doesn't work. WHAT IS WRONG???? :shock: [code=python] #media control #Copyright 2008 Evstevemd #Just media Player to play the playee import wx import wx.media as media import os, sys class MediaPlayer(wx.Frame): def __init__(self, parent, id, … | |
How would I empty my linux trash from python? Would I just do a simple os.remove? Or is there an easier way? I am also working on deleting all files within a directory, for multiple directories. I have found this: [CODE]#!/usr/bin/env python import os def nukedir(dir): if dir[-1] == os.sep: … | |
Ok, so here's the deal. I've got a CSV file in the following format (example): Jon | Steve Frank | Joe Steve | Jon Joe | Jon I want to create a python program that reads in the CSV file and outputs a count of relationships, if that makes any … | |
I am trying to write a program that shows the longest word from an input . This is what I have so far, I am not sure what to set x equal to, or if that is even right: [CODE]sent=raw_input('Enter sentence:') splicedsent=sent.split(" ") longestword=splicedsent[0] if x in len(splicedsent[1:])>splicedsent[0]: longestword=x else: … | |
Hi, I have been learning Python and have a quick dictionary question. I am trying to make a "vocabulary test" to help myself study, and am trying to do it with a dictionary. So far I have this: [code=python]testwords = {"uno":"one","dos":"two","tres":"three","cuatro":"four",\ "cinco":"five"} def vocabtest(): for value in testwords: print "What … | |
I am a freshman in highschool and have just started learning Python. This week I have an assignment on while...for...and lists. I have tried this problem and this is what I got so far, I'm not sure if it is correct at all: start=float(raw_input("Enter the starting value:")) end=float(raw_input("Enter the ending … | |
I have some code for a routing algorithm in python programming language but i don't understand the code at all. I am only a beginner and i was wondering if anyone could explain it for me in plain text. Could you please go through and explain each part. Cheers. Here's … | |
The debug process never connected back to WINGIDE: Aborting debug session I have tried repair python, no success. Also tried run IDLE same story | |
Ok i can send this soap request in PHP no problem. But i need to do something similar with python. The authentication happens in the SOAP headers. How can i construct a soap header with python, i am using the module SOAPpy. Any help is appreciated. | |
hi guys im trying to make the words that have capital letters in small caps, then count the numbers of times a certain words appears in the text. i managed to count the number of times a word appears but now im having trouble converting upperletters to caps on all … | |
I'm trying to get reflection to work in Python. I'm used to it in java but am having trouble getting it to work in python. Here is basically the code I have. [CODE] c = myObject.__class__ # get the class of the object newC = c.__new__(c) #create a new instance … | |
How do you assign a random int to a variable more then once say i use this code [code] import random x = 1 while x == 1: random = random.randint(1,100) print random raw_input ("Push <enter> to print another random number") [/code] It will print out the first random number … |
The End.