15,406 Topics
![]() | |
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 … | |
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 … | |
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 … | |
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 … | |
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 * … | |
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)) … | |
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 … | |
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! | |
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 … | |
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, … | |
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 … | |
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 … | |
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, … | |
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 … | |
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 … | |
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 … | |
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 … | |
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 | |
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 … | |
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 … | |
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 … | |
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 … | |
Hi, I have a GUI written with wxPython that contains a form. When the button is clicked, a script is executed to cycle through a specified directory and resize the images to a 50% size (the image manipulation is done with PIL). I used to run this script via the … | |
I am attempting to input data from a log file into a database with tables for each network device. The table name is set via a parameter for the function. The script crashes after running stating the table name does not exist. If the actual table name (routerA) is listed … | |
I have recently started learning Python and I have come across a problem I can't seem to resolve. Since the application I am making is already rather large, I just created a small example script to show the problem I am having: [code] #!/usr/bin/python import socket, threading, processing, os def … | |
I was playing with ListCtrl and I have only been able to get first value of the selected row. Is there any method I can use to get the rest of column's value in the selected row? Help please Steve | |
The following program is able to download the python programs contained in a thread of the python forum. Just start the program, it will prompt you for the thread number and create a directory with the code extracted from the thread. I used it to download all the wx examples. … | |
I have so far been playing with wxpy's media control and is greater, but needs backend which is not good habit anyway. Is there any framework, that can in its own play multimedia file independent of OS's as backend?? I use python 2.5.2 Thanks all | |
Hi I am trying to ask the user to input a binary number and checking to see if the input contains 0's and 1's. If not, I want to inform the user that the input was invalid and ask them to retry. Any help to fix my code would be … | |
need to read the config file and then zip files in path. dont get any errors but files not zipping [ICODE]# config file [clean1] path = C:/Project/Log1 action=zip [clean2] path = C:/Project/Log2 action = zip #zip.py import zipfile, os, time, sys, ConfigParser, zlib def zip_fh(): zip = zipfile.ZipFile('%s.zip' % (path), … | |
Hi, Iv been playing about trying to get a string onto the clipboard, but Iv had no luck at all. Iv done quite a bit of searching, but Iv only ever seen any examples that relate to Windows, and I'm using Ubuntu here. Any ideas anyone? Max | |
Hi, I have a problem with a sequence. The sequence is a number range from 1 to 100. I need to show each number and also the running total of each number. for example First number in sequence is 1, running total 1. Next number in sequence is 2, running … | |
Hi there. I'm writing a program that uses a tree control as a form of navigation, and the structure of the tree is set up in code as the program loads. This is fine for now, but there is the possibility that the structure will need to expand considerably, which … | |
Greetings. I'm a python noob and I'm stuck with some coding. Say you have a list with a number of elements, some of which are the same. For instance: mylist = ['blue', 'red', 'green', 'green', 'red', 'red'] Is there a way to return how many times each string occurs in … | |
Hi All, For long now have tried to get Python bindings and none is there. jlgm suggested me to try ctypes and I dived in. But there are few examples on using ctypes for new bees like me. I tried to take lame_enc.dll (The file made me to learn ctypes … | |
Hello All, can someone tell me exactly what is done by this function? Thanks alot! | |
How do I get python to pick a random word? Do I have to link it with a dictionary? If so how do you do that. Exercise from Python Programming for the absolute beginner Create a game where computer picks a random word and player has to guess the word. … | |
There's two different things I'm trying to figure out how to do with Python. First, when I want my program to go through a function, which then moves on to another function..... so say I start with main(). I have variables A and B. I go on to function Do_This(), … | |
Hi. I have an HTML Control on my frame and I am able to display pages in it: [CODE] self.krtc = html.HtmlWindow(self, style=wx.NO_FULL_REPAINT_ON_RESIZE); self.krtc.LoadPage("apitest.html") [/CODE] However, I'm having real problems trying to pick up a CTRL + C event (Or a right mouse click event) to copy any selected text. … | |
Hey hey! I'm trying to write a script that finds out if a given program name exists in the OS environments PATH variable (cross plathform). Thing is, I get a NameError, it's probably a simple error, but I've struggling with it the last hour. Any help would be appreciated [CODE=python] … | |
Hi, I have some oython application which uses some COM server. on of the functions in the COM servers expects getting 64 bit unsigned integer (i.e. VT_UI8), but the problem is that python automatically converts 'small' integers to 32 bit integers (even if casting them to long) anf this leads … | |
Hi guys, I'm currently working on a program to return whether an inputted number is perfect or not. I've found that the formula for the perfect number is If 2n-1 is prime then 2(n-1)(2n-1) is perfect. I've worked out some code, but I'm stuck. [CODE]Def listfactors(n): For 1=2 to n/2 … | |
Hey guys im doing the NCSS python challenge and I need help!! ok so here's my current problems (p.s. my teach cant even help) PROBLEM 1 ************************ [code]# This is a Python file def fibonacci(n): return (n <= 1) and 1 or fibonacci(n-1) + fibonacci(n-2) def decrypt(s): def helper(s): return … | |
Hi, i'm new to python. I'm trying to input a stack of (prefix.tif) images, modify them to png files and output the new files as prefix.png. One code that i was told to use allows me to modify the input name by adding something to the beginning of the name. … | |
I want to make a python game with just the basic python library and Tkinter.. is this possible ? and also where would i go to find the logic behind the Simon Game..the memory part so it makes the buttons click and remember each time? also this is for a … | |
Some languages like C# create an Auth object to authenticate themselves on a soap server. for example [CODE] cpLatestBrief.authValue = new auth(); cpLatestBrief.authValue.username = "username"; // your aql username cpLatestBrief.authValue.password = "password"; // your aql password [/CODE] how can you do this with python? | |
Hi! I need help with a memory game. I dont know how to do when I want the users choice to appear. The function guessing. I want the user to first write e.g. A1 and then B2. and the doldmatris() is the one with the words. Then the start function … | |
I need help with this problem Generating Random Cities Write a function called generate_cities(min_x, max_x, min_y, max_y, n, distance) that generates a list of cities with random coordinates. The parameters represent the following: * min_x, max_ x: the minimum and maximum values for the x coordinate of each city * … |
The End.