15,181 Topics

Member Avatar for
Member Avatar for anilk

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> …

Member Avatar for Stefano Mtangoo
0
1K
Member Avatar for pocnib

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 …

Member Avatar for woooee
0
437
Member Avatar for happymadman

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 = …

Member Avatar for sneekula
0
98
Member Avatar for Puppetmaster

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 …

Member Avatar for Prahaai
0
103
Member Avatar for kruglok

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 …

Member Avatar for jlm699
0
17K
Member Avatar for wotthe2000

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 …

Member Avatar for Murtan
0
254
Member Avatar for Damian_xyz

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" …

0
52
Member Avatar for adam291086

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: …

Member Avatar for adam291086
0
119
Member Avatar for Micko

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) …

Member Avatar for hunkaboy2003
0
4K
Member Avatar for StarZ

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 …

Member Avatar for Murtan
0
136
Member Avatar for cyberjam39

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 …

Member Avatar for sneekula
0
105
Member Avatar for jvignacio

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 …

0
72
Member Avatar for jloyzaga

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>

0
41
Member Avatar for gabec94

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]: …

Member Avatar for gabec94
0
4K
Member Avatar for Stefano Mtangoo

I want to wait the song to finish after it finishes, I want to call another function How do I do that in wxpython

Member Avatar for Stefano Mtangoo
0
144
Member Avatar for mmeclimate

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 …

Member Avatar for mmeclimate
0
2K
Member Avatar for Stefano Mtangoo

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 …

0
61
Member Avatar for Stefano Mtangoo

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 …

Member Avatar for Stefano Mtangoo
0
127
Member Avatar for Stefano Mtangoo

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, …

Member Avatar for Stefano Mtangoo
0
169
Member Avatar for krammer

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: …

Member Avatar for krammer
0
280
Member Avatar for SteveJ.

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 …

Member Avatar for jice
0
194
Member Avatar for gabec94

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: …

0
72
Member Avatar for SoulMazer

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 …

Member Avatar for SoulMazer
0
283
Member Avatar for gabec94

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 …

Member Avatar for stephendoyle75
0
84
Member Avatar for Damagh25

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 …

Member Avatar for Damagh25
0
224
Member Avatar for Stefano Mtangoo

The debug process never connected back to WINGIDE: Aborting debug session I have tried repair python, no success. Also tried run IDLE same story

Member Avatar for Stefano Mtangoo
0
122
Member Avatar for adam291086

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.

0
36
Member Avatar for jvignacio

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 …

Member Avatar for jvignacio
0
223
Member Avatar for jcafaro10

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 …

Member Avatar for jlm699
0
96
Member Avatar for happymadman

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 …

Member Avatar for happymadman
0
229

The End.