15,179 Topics

Member Avatar for
Member Avatar for Thropian

if been using python's tkinter for awhile to write programs when I caused an issue that I'm not sure what is my code is long even after I gutted it. [CODE]from Tkinter import * import random import operator info_dict = {} info_dict["area"] = 1 info_dict["slime_spot"] = random.randint(1,36) info_dict["slime spotter"] = …

Member Avatar for Thropian
0
110
Member Avatar for ciliath

so i am creating this message field with [CODE]self.text = wx.TextCtrl(panel, pos=(150,22),size=(100,20))[/CODE] and it works, no problem but i'd like that the text gets written from the right and not the left which is a pain... anyone have a slight clue on how to do it ? help appreciated :)

Member Avatar for ciliath
0
221
Member Avatar for ljjfb

Hi all professionals, I uesd subprocess module to spawn a new process and then implement the command. The final result is the output via stdout. Here is the code I wrote: [CODE] import subprocess proc = subprocess.Popen('egrep '^HTTP/' *', shell=True, stdout=subprocess.PIPE,) stdout_value = proc.communicate()[0] print 'results:' print stdout_value [/CODE] And …

Member Avatar for richieking
0
190
Member Avatar for Favolas

Hello. I'm new in Python and I only want to use basic programing skills. I have this example code: [CODE] list_a = [a, ] * 15 list_b = [b,] s = 5 n = 2 [/CODE] and want to obtain this: [CODE] [b,b,a,a,a,a,a,b,b,b,b,a,a,a,a,a,b,b,b,b,a,a,a,a,a,b,b] [/CODE] basically I want to insert list_b …

Member Avatar for woooee
0
110
Member Avatar for sandesh56

[CODE] C={} D={} C['21600']=[{'vid':1,'route':[11,12,13,14,15]},{'vid':2,'route':[21,22,23,24,25]}] C['23500']=[{'vid':3,'route':[31,32,33,34,35]},{'vid':4,'route':[41,42,43,44,45]}] #D['21600']=[{'vid':1,'route':[11,12,13]},{'vid':2,'route':[23,24,25]}] #D['23500']=[{'vid':3,'route':[31,32]},{'vid':4,'route':[45]}] D=C for n in D: for n2 in D[n]: if n2['vid']==1: n2['route'].remove(14) n2['route'].remove(15) elif n2['vid']==2: n2['route'].remove(21) n2['route'].remove(22) elif n2['vid']==3: n2['route'].remove(33) n2['route'].remove(34) n2['route'].remove(35) elif n2['vid']==4: n2['route'].remove(41) n2['route'].remove(42) n2['route'].remove(43) n2['route'].remove(44) print 'Printing D ', D for u in D: for u2 in D[u]: print len(u2['route']) …

Member Avatar for woooee
0
132
Member Avatar for yellowkaiq

So I have the y and e endings down, just need some help with the middle. Basically, I need to double the last letter before adding er if: the last letter is b,d,g,l,m,n,p,r,s or t and the second to last letter is not the same as the last letter. [CODE]def …

Member Avatar for yellowkaiq
0
185
Member Avatar for blacknred

I'm trying to parse xml file and convert all the unix timestamps in it to datetime... [QUOTE]<Sample> <TimeStamp>1291052077</TimeStamp> blah blah blah blah </Sample> <Sample> <TimeStamp>1291052077</TimeStamp> blah blah blah blah </Sample> </Content>[/QUOTE] [CODE]import fileinput file = raw_input("Enter file: ") file = open(file, "wb+") for line in fileinput.FileInput(file,inplace=1): if "TimeStamp" in line: …

Member Avatar for richieking
0
186
Member Avatar for king_koder

The [URL="http://www.python.org/"]official Python website[/URL] is now conducting a poll to find what Python package users want most to get ported to Python 3. Top on the list is django followed by wxPython and numpy. See the full results at- [url]http://www.python.org/3kpoll[/url]. Also, do vote(or nominate) the Python package that you want …

Member Avatar for richieking
1
92
Member Avatar for michaeljfox

So my teacher wants us to design a short program to add 2 polynomials, asking the user for the degree and coefficients, and print out the new coefficients. ie: poly1 deg=2 coeff= 3 4 5 poly2 deg=2 coeff= 2 5 6 output would be: 5 9 11 however, sometimes one …

Member Avatar for TrustyTony
0
2K
Member Avatar for Harris00

Hello I have below code to draw the circle, i want to add vertical line dividing the circle half and horizontal line and cross lines like in attached document. all the lines divide the circle equally with 45 degrees angle. I really appreciate the guidance from turtle import * r=100 …

Member Avatar for richieking
0
1K
Member Avatar for Zealhack

The code below just makes it have one letter/number per line then it forms a new line, but I would like to have the numbers on each line and only form a new line everywhere there is a comma. Is there a way to do this? Thanks! [code] def hyp(aFile, …

Member Avatar for Zealhack
0
179
Member Avatar for bretthay93

write a program code thathas two functions: first() and second(). Function first() should print the string "in function first()" and then call function second()> functions second() should print the string "in function second()". in the global scope, you should call function first.

Member Avatar for WildBamaBoy
0
144
Member Avatar for M3M69

Goodafter noon all, i would like some help on how to modify a python program to do the following: 1. Read both files actors.small.list and actresses.small.list and, using a dictionary, build a database that maps from each actor to a list of his or her films. 2. Two actors are …

Member Avatar for M3M69
0
123
Member Avatar for longlongsilver

i need the code to ask the play for a guess with a call to ask_number() here is my code i have a problem in that it won't run can somebody offer me some help? thanks [CODE]import random secretNum = random.randrange(100)+1 tries = 0 while tries < 5: try: def …

Member Avatar for TrustyTony
0
213
Member Avatar for afireinside

Hello, I have about 500,000+ txt file for about 7+ gigs of data total. I am using python to put them into a sqlite database. I am creating 2 tables, 1. is the pK and the hyperlink to the file. For the other table I am using an entity extractor …

Member Avatar for woooee
0
1K
Member Avatar for danholding

im a newbie to python still so bare with me if i have gone down the wrong route or my explanation is confusing!! any ideas on how i can sort my list by the size of the file at the moment it is getting the size of the file and …

Member Avatar for TrustyTony
0
239
Member Avatar for kshaaban

Hey everyone! I have been working on some c++ code which point tracks a user and extrapolates their co-ordinates within 3D space. i have the co-ordinates in c++ stored as variables and would like to use these variables within the Blender game engine to position an object within the scene. …

Member Avatar for kshaaban
0
207
Member Avatar for kafro

I have a .txt file with some data in it that I would like to transfer into a tuple. I'm able to do that but am having trouble with the format I would like it in. If my .txt file looks something like: North America, 1, 5 South America, 2, …

Member Avatar for group256
0
217
Member Avatar for tachyonshower

hi, i had posted before but decided to just give it a go on my own. now i am sort of in a similar spot with my code. i am modeling an oscillatory system by coupling spring-masses in a lattice formation. i would ideally like to have a second lattice …

Member Avatar for tachyonshower
0
197
Member Avatar for johanngomes

(Python begginner, please be gently) Hi, i'm having some troubles with turning one python project i made into an executable, using py2exe (via GUI2EXE). The program is compilling well, it generates the executable, but when i try to execute it, i get the following error: ImportError: No module named twitter …

0
56
Member Avatar for kshaaban

Hi everyone, i was wondering how it might be possible to send variables from a programme written in c++ to be used in a separate application which is coded in python. I am using opencv to calculate points of interest in c++. I would then like these resulting co ordinates …

Member Avatar for kshaaban
0
306
Member Avatar for jrp370

im trying to create a function that does the same thing as the built in list opperation for index with out using the built in command for it. what i mean is i cant have a list lets say myList=[1,2,3,4,5] i then cant simply go mylist.index(3) any idea on how …

Member Avatar for TrustyTony
0
107
Member Avatar for convoluted

Hey all. Let's say I would like to periodically poll for a change in a variable/device/etc. Obviously I would like to use an infinite loop and when need be, break from the loop to end the polling routine. What I don't what to do is peak my processor usage by …

Member Avatar for convoluted
0
189
Member Avatar for Finki

This are some exercises for my exam. Need some help ASAP. Program for 9 or 10 points would be the best, because I only need that for exam. [B]6 points:[/B] Write a program that reads a file .picasa.ini and copies pictures in new files, whose names are the same as …

Member Avatar for woooee
-2
196
Member Avatar for cwarn23

Hi everybody. I have a question about the best way to retrieve a list of possible source values from the & operator without checking every combination between the range required. The basic problem I face is I have [B](a&b)=c[/B] I know the values of b and c but need to …

Member Avatar for TrustyTony
0
218
Member Avatar for funfullson

Hello friends. In my project I need to know if some one is online or offline. and other problem is that some one are online but are invisible. At all how I can find the users state? for example users of yahoo or google. I realy know nothing about this …

Member Avatar for richieking
0
244
Member Avatar for vlad44

Hi everybody, I'm totally newbie to python I've seen some tutorials and think that is an easy to learn language but I couldn't figure out the real function of scripting language I've read some brief notes about the function being to control an existing application . But I couldn't understand …

Member Avatar for vlad44
0
129
Member Avatar for c_shaft05

I've been messin with python for little under a month now. I've come across one of these sample questions that make you think, stating to compute and print a table of Celsius temperatures and Fahrenheit equivalents ever 10 degrees... well i guess the main thing is i need help trying …

Member Avatar for Duskic
0
430
Member Avatar for Simplified

Hi All I'm getting very odd behaviour when using file.write(variable) - what happens is that if I print out the variable using the print function I get this: [ICODE]4CE1FFC64101843801[/ICODE] ... which is what I expect. However, when I try to write this to a file (using the variable 'valid' to …

Member Avatar for Simplified
0
105
Member Avatar for iamdabobo

I'm working on a calculator in python. Introductory college course, so I know some stuff, but I'm far from being an expert of any sorts. This is a scientific/graphing calculator, so I'm parsing a whole string of input. Say the user inputs integ(3*x+3,0,1) (integrate 3x+3 from 0 to 1). My …

Member Avatar for Gribouillis
0
2K

The End.