15,190 Topics

Member Avatar for
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
302
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
85
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
233
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
126
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
230
Member Avatar for jcp200817

Hey, I have to do a script for class in which a user inputs a phone number like the ones you see on TV. 555-buy-this I need to make a script that will change the alphabetic characters to numbers. I asked my teacher and he said we had to do …

Member Avatar for jcp200817
0
448
Member Avatar for jcafaro10

Hey all, What does it mean when you get an error that says ImportError: no module named main. I wasn't aware I was trying to import a module named main. I don't even have a module named main. I'm using Jython and I'm reflecting on an instance of a python …

Member Avatar for jcafaro10
0
5K
Member Avatar for lllllIllIlllI

Hi guys, I was making a program yesterday that would send an email using the email modules of python as well as the smtp module. My problem is when i put it into an exe using py2exe and vega's code snippet setup i get some problems. This is the error …

Member Avatar for lllllIllIlllI
0
2K
Member Avatar for tomtetlaw

Hi all! Im making a mario clone, and i was wondering how to write the jump function in the Mario class, any help would be good, im using PyGame by the way. heres my code so far: [code=python] #usr/bin/env python import sys import os import pygame from pygame.locals import * …

Member Avatar for tomtetlaw
0
160
Member Avatar for tomtetlaw

Im testing out blit() and i ran into this error: [code=python] Traceback (most recent call last): File "/home/tom/Desktop/pygame/test/main.py", line 15, in <module> screen.blit('image.jpg', (10,10)) TypeError: argument 1 must be pygame.Surface, not str this is my code: import pygame pygame.init() running = 1 while running == 1: screen = pygame.display.set_mode((800, 600)) …

Member Avatar for tomtetlaw
0
2K
Member Avatar for lllllIllIlllI

Hi guys, I have a program that lets the user play a sound but i was wanting to know how i could make it so the user could vary the speed in which the sound plays so the sound can play slowly and quickly and normaly as well. Is this …

Member Avatar for lllllIllIlllI
0
3K
Member Avatar for StarZ

i have just been learning python(tuple) at school. And this is my first assignment. I can't seem to figure it out. The assignment is on this website: [url]http://schools.tdsb.on.ca/danforthcti/python/main.html[/url] Go to lesson 8>scroll down>its called programming Assignment 9. Can someone help me out? It's simple enough right? thank you!

Member Avatar for vegaseat
0
157
Member Avatar for kiddo39

I have a small image with a black background and red lines in it and I need to count the red pixels. I know I need PIL, but I'm not sure which method to use. Then once I have the counts I need to equate them to a character, so …

Member Avatar for vegaseat
0
2K
Member Avatar for ctaroz

can somebody help an old man? I started to study Python and I'm OK with IDLE. But I cannot understand how to use it as a server language with my local server Xitami (that I use very well with PHP). Please help me: I need very clear instructions Thank you, …

Member Avatar for ctaroz
0
169
Member Avatar for Nanz

Hello all. I want to craete a empty double dimensional array. Later i will get the row and column length. But row length varies each time program. But i will be having the lenght of the row. So hoe to write a generic code for creating a empty 2D array …

Member Avatar for jlm699
0
63K
Member Avatar for ccandillo

I am connecting to Active Directory using python-ldap to query some information. I am also using getpass to get my password used to bind via ldap. This works just fine. What I am trying to do is to use my currently logged on username/password to bind to active directory so …

0
72
Member Avatar for MaracKoMarac

Hi all. I have a very simple app, but I don't know how to get position of the circles. Here's the code: [CODE] from Tkinter import * master = Tk() global w def dotToDot1(event): global w circles = 0 x = event.x y = event.y c1 = w.create_oval(x, y, x+10, …

Member Avatar for MaracKoMarac
0
118
Member Avatar for vmars

Greetings! I just downloaded Python 2.6 from Python.org . It came with IDLE Gui. Poking around the internet, I see a bunch of other pthon related names like: IDLE, wxPython, Tkinter, Widget toolkit, PyGTK, PyQT, Tk GUI . I am not really sure what all I have, and what else …

Member Avatar for Kezoor
0
314
Member Avatar for jcafaro10

This is probably an easy problem to solve but I'm having a bit of difficulty. The error is UnboundLocalError: local: "switch" and that's all the error says. The line refers to the line switch = - switch in the following code: [CODE] boundary = game.getBoundary() game.setBackground(java.awt.Color.black) level = 1 maxX …

Member Avatar for jcafaro10
0
179
Member Avatar for tucksterble

Hello everyone. I've just signed up to 1 years hosting with Uk based Fasthosts. They provide support for Python scripting and a free 150MB MySQL database on their Linux package. My problem is that they don't seem to have the MySQLdb module installed. Is there any way I can get …

Member Avatar for jbennet
0
128
Member Avatar for adam291086

Hello, I have a group of regular expressions <Element Generation at d66238> <Element Vitals at d662b0> <Element Network at d66670> <Element Hardware at d66eb8> <Element Memory at d6ac88> <Element Swap at d6e0a8> <Element Swapdevices at d6e238> <Element FileSystem at d6e5d0> <Element Vitals at d662b0> i need to get the word …

Member Avatar for Gribouillis
0
101
Member Avatar for jmn0729

If you wanted to run bash shell commands inside of a script (python), how would you do it; beginner here :) Thanks for the input, RHCE

Member Avatar for Gribouillis
0
408
Member Avatar for oldSoftDev

I am working on a problem and trying to read a data and creating a chart the problem is when ever I read any thing from file it add \n or \r in with it but I change the type of digital data but I dont know what to do …

Member Avatar for oldSoftDev
0
105
Member Avatar for tomtetlaw

i made a game called chimp and when i start it it just freezes the game window, idle and the python shell, any ideas? heres the code" [code=python] import os, sys import pygame from pygame.locals import * if not pygame.font: print 'Warning, fonts disabled' if not pygame.mixer: print 'Warning, sound …

Member Avatar for tomtetlaw
0
198
Member Avatar for lllllIllIlllI

Hi guys I am making a program that uses a text control to move messages from one place to another. My program needs to be able to, once the message has been moved, delete what is in the textCtrl. I can go: [code=python] self.textCtrl.SetValue('') [/code] but that leaves me with …

Member Avatar for Freaky_Chris
0
236
Member Avatar for Michigan_Guy

Greetings everyone. I just jumped into Python for the first time this weekend and I'm finding it to be a very easy and enjoyable learning process. This forum has been particularly useful for finding code snippets and answers to questions that I ran into and others had posted about. So …

Member Avatar for jbennet
0
108

The End.