15,181 Topics

Member Avatar for
Member Avatar for RMartins

How can we in python change the number of elements in a line to the next, this is, for example... We have the following txt file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 And we want a program which the output …

Member Avatar for woooee
0
91
Member Avatar for karthik.c
Member Avatar for scru
0
20K
Member Avatar for curiouskitten

i need help understanding how to fix my code (But please no explicit answers, I really need to understand.) I need to create a program (I'm using IDLE) that will count the number of characters in a given sentence WITHOUT counting spaces. So far I have: [CODE] S = raw_input("Enter …

Member Avatar for oldSoftDev
0
104
Member Avatar for beanryu

I start learning about python, so i read the tutorial: they show this: >>> x = int(raw_input("Please enter an integer: ")) Please enter an integer: 42 >>> if x < 0: ... x = 0 ... print 'Negative changed to zero' ... elif x == 0: ... print 'Zero' ... …

Member Avatar for breatheasier
0
2K
Member Avatar for sony_b

I am trying to write a python script that can take a word from one file and transfer it to a specific location in another file. for example, lets say i have a file called hb15b.txt and it includes the following: MODIFY-USER 2671, "hb15b01", " UGz9", 1, How can i …

Member Avatar for woooee
0
140
Member Avatar for Ene Uran

For the second year running Python has been selected as the Language of the Year by Linux users: [code] Linux Users' Programming Languages of the Year 2008 PHP 115 13.36% Perl 72 8.36% Python 226 26.25% Ruby 46 5.34% C 114 13.24% C++ 129 14.98% Java 106 12.31% Lisp 9 …

Member Avatar for breatheasier
0
143
Member Avatar for scoob_m

Hello, I have a code file from the boto framework pasted below, all of the print statements are mine, and the one commented out line is also mine, all else belongs to the attributed author. My question is what is the order in which instantiations and allocations occur in python …

Member Avatar for jrcagle
0
100
Member Avatar for mahela007

I want to copy some files using python. Can someone tell me how to use the shutil.copy() command properly? thanks

Member Avatar for Ene Uran
0
201
Member Avatar for MaxVK

Hi, I have written a nice little editor using the RichTextCtrl, and so far everything is working fine, however, for some reason the delete key does not work as expected. If I select something and hit delete then the selection is removed, but if I click anywhere in the text …

Member Avatar for MaxVK
0
127
Member Avatar for karthik.c

hi guys wat if List is equivalent 2 Arrays in c or do we have Arrays seperately defined in python??

Member Avatar for karthik.c
0
181
Member Avatar for ihatehippies

How do you bind something like a listbox to an event, but keep that events default actions... ie when you bind a listbox to EVT_RIGHT_DOWN it overrides the SetSelection method that is normally called. I'm trying to call a popup menu on the right down event but I also want …

Member Avatar for lllllIllIlllI
0
92
Member Avatar for juzzy

is it possible, well yes of course its possible, but does anyone know the best way to alter the colour of a word within a sentence in a wxpython window. I know how to change the colour of the entire text but not a specific word. So for instance if …

Member Avatar for juzzy
0
1K
Member Avatar for scru

Does Python have a concept of class properties (static properties if you may)? I know there are class attributes, but I can't just use one. It's very critical that I control what values can bet set as the class attribute, which I can use the property setter to do.

Member Avatar for Ene Uran
0
98
Member Avatar for mahela007
Member Avatar for lllllIllIlllI
0
646
Member Avatar for eyewirejets

I'm trying to restrict the users input to the selected characters only. "W" "w" or "L" "l" Anything else entered, an error message should display. Can anyone please look at this and tell me what I'm doing wrong? Thank you [CODE] # User Enters either W = Win and L …

Member Avatar for jrcagle
0
116
Member Avatar for mahela007

Hi.. this is my first post on these forums. I learn python as a hobby. Will learning sequential programming be sufficient for my needs? (I won't be pursuing a career in programming. I just do it so that I can keep my self busy and because I like programming with …

Member Avatar for jrcagle
0
77
Member Avatar for scru

I know Python introspection feature are powerful, what I can't seem to figure out is how to get the name of the current class. Example: class Foo: def bar(self): print(classname) Then my output should be `Foo`. Bonus points if I can get which module it resides in too. Thanks!

Member Avatar for Ene Uran
0
133
Member Avatar for mahela007

I have installed python 3 on my kubuntu PC. However as the default version of python on kubuntu is 2.5 Idle uses python 2.5 instead of the newly installed python 3 (i used the "python3.0" package for installing python and "idle" package for IDLE when i was installing using synaptic …

Member Avatar for Ene Uran
0
65
Member Avatar for curiouskitten

I am a beginner python programmer and need some help with this problem. To provide a code that will lowercase all consonants and upper case all vowels. Needs to be a relatively simple code (like 2-3 lines lol) For example i have started this: S=raw_input("Enter Sentence: ") print S.upper() # …

Member Avatar for Ene Uran
0
11K
Member Avatar for trihaitran

I just reinstalled OS X 10.5 Leopard on my laptop and restored my data/applications from a Time Machine backup. When I use urllib.urlopen() I get the following error: [code] >>> import urllib >>> u=urllib.urlopen(aUrl) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 82, in …

Member Avatar for trihaitran
0
130
Member Avatar for thehivetyrant

I have currently built a database (based on IMDB) that i can add dictionaries too, list them and exit. [B]I will put the program so far at the bottom of the page, just paste it in and run ti to see what it's like.[/B] I am trying to add a …

Member Avatar for thehivetyrant
0
119
Member Avatar for scru

Several things have led me to writing this post However, late last week I did some poking around in the Windows C API from ctypes (not using pywin32) for a project I was finishing up, and I [I]loved it[/I]! Since then I've been playing around with ctypes and Windows function …

Member Avatar for lllllIllIlllI
0
207
Member Avatar for memphis1234

I have to write a program which generates a pascal's triangle. The user inputs the height of the triangle and it supposed to generate one. This is what I have so far and I don't know how you would keep adding rows after the second one. I'm so lost :( …

Member Avatar for yilmazhuseyin
0
995
Member Avatar for strobon

hi...can somebody give me a little help here. i get error message : 'file' object is not callable its a program that call shell script (shell script run "fusion.deb"). here`s the code: test.py [CODE]#!/usr/bin/env python import sys import os try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade …

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

I have Dictionary that I update time after time and the dictionary result get inserted to the wxListCtrl in report mode. The problem comes when I insert new data. It seems that the unicode character (u') is also get inserted as part of data. Is there any way to strip …

Member Avatar for Stefano Mtangoo
0
112
Member Avatar for apollo1492

i need to be able to have python spit out a date like this (mm/dd/yyyy) even if the user doesnt add the "/" to there input. here is what i got so far. import string date = raw_input(enter your date:") print date[0:2]+'/',date[2:4]+'/',date[4:8] the output is mm/ dd/ yyyy. how would …

Member Avatar for yilmazhuseyin
0
97
Member Avatar for RRamya
Member Avatar for RRamya
0
93
Member Avatar for besktrap

hey everyone. i am writing a program in python w/ Tkinter and ran into a problem with padding. So, i have a Label object named DataPool_Text. when I run it (side=TOP), it goes to the top middle of the screen. I know how to use padx, but what would I …

Member Avatar for woooee
0
69
Member Avatar for thehivetyrant

I have been asked the following: create inputs for a half-adder using python and the outputs i expect. I was hoping someone could just have a look at this for me and see if i've got the right idea. This will work from a copy and paste straight off the …

Member Avatar for BearofNH
0
103
Member Avatar for drew7py

I am trying to create an array of integers from a list of strings to do some calculations, but all I can get is an array of strings or an error. Does numpy have any functions to do this? any help at all would be much appreciated. infile: 23 CL …

Member Avatar for Ene Uran
0
3K

The End.