15,406 Topics

Member Avatar for
Member Avatar for Z8934

I’ve got a piece of third party software containing classes that I want to modify by subclassing. My problem is that one of the third party classes is not accessed directly but returned by the third party class through a method call. So: [code]factory = ThirdParty.Factory() node = factory.getNode() #node …

Member Avatar for Gribouillis
0
159
Member Avatar for harrykokil
Member Avatar for Z8934
0
76
Member Avatar for JeyC

Are there python commands to achieve the following : 1. Create new text files 2. Write certain text to these file (similar to DOS Echo> command ???)

Member Avatar for Arrorn
0
135
Member Avatar for sharat87

Hello everyone! just dumped bytes forums and joined daniweb... hope its a good decision :P anyway, could you guys take a second to look at the following code... [code=python] import subprocess as sp cmd = "awk '{print $0}'" ex = sp.Popen(cmd.split(' '), stdin = sp.PIPE, stdout = sp.PIPE, stderr = …

Member Avatar for sharat87
0
4K
Member Avatar for harrykokil

how do I trigger a function after x seconds in pygame?? i have seen the "pygame.time.set_timer(event,ms), but i want to trigger a function instead of an event. hoping for a quick reply thanks...

Member Avatar for Arrorn
0
60
Member Avatar for Foxcow

Whenever I open Python I get Socket error: No connection could be made because the target machine actively refused it. Also I get IDLE's subprocess or personal firewall software is blocking the connection. I was wondering how to fix this?

Member Avatar for lllllIllIlllI
0
92
Member Avatar for lilkid

[ATTACH]9597[/ATTACH] ok i want to read this file into a dictionary and this is the output d={"flight":T34712, From:ABERDEEN, scheduled 0800, remark landed} etc flight is the key do i have to parse the text file i know i cant put it straight into the dictionary as i get this output …

Member Avatar for lilkid
0
164
Member Avatar for jessica2009

[code=python]def main(): print (" PC : Hi there.whats your name?") userit = raw_input (" user :") print (" Pc : Nice to meet you " ) , userit , userit = raw_input(" Do you like python? (A=its Great, B=its Ok, C=its Rotten)") if userit == A: userit = userit.upper() print …

Member Avatar for woooee
0
139
Member Avatar for shadwickman

Hello, I've loved Python ever since I picked it up a couple years ago, but I have a question about the proper way to do something. There's a way of condensing an if/else conditional that has 2 options (True, False), for simple things. Assume that [icode]playerWins[/icode] is a boolean: [code=python] …

Member Avatar for shadwickman
0
116
Member Avatar for crumpet

Hi, I'm trying to create a "command line" in Python, which makes a user input a certain command and its associated data, without the use of brackets. So the user would input: >>> test 1 2 3 So it would carry out a command: [CODE=python] def test(firstnum,secondnum,thirdnum): return firstnum,secondnum,thirdnum [/CODE] …

Member Avatar for crumpet
0
154
Member Avatar for DisembodiedLoaf

I have two programs I've been working on for my class but I keep getting different errors. First one: Write a boolean function called isTriangle that receives three numbers and returns true or false based on whether or not the numbers are possible lengths of a triangle. If the sum …

Member Avatar for shadwickman
0
181
Member Avatar for jessica2009

[code=python]def main(): print (" PC : Hi there.whats your name?") userit = raw_input (" user :") print (" Pc : Nice to meet you " ) , userit , userit = raw_input(" Do you like python? (A=Its Great, B=Its Ok, C=Its Rotten)") if userit == A: userit = userit.upper() print …

Member Avatar for vegaseat
0
129
Member Avatar for jessica2009

python program to engage a user in conversation.requirements are a. firts question should ask the user for name .this name should then be used with the following questions b.Ask 4 more questions c. Each question should have 3 possible answers.That us option A,B or C(only) d. Have a different comment …

Member Avatar for jessica2009
0
103
Member Avatar for harrykokil

how can threading in python help me in my traffic simulation project? can i use it to detect other cars?

Member Avatar for scru
0
67
Member Avatar for lilkid

[ATTACH]9572[/ATTACH] Hello basically ive parsed a website's data into an object. I wrote it to file and read it back in to write to a dictionary. but when i read it in it reads it like 3 times. so im a bit confused as to why ad would like to …

Member Avatar for lilkid
0
128
Member Avatar for loren41

[B]I have a text file that contains multiple records. Within the records, I am able to locate the line containing the desired text and read it into a string. Inside the line, I know the number of the starting character for the words I need. The length of the substring …

Member Avatar for sneekula
0
259
Member Avatar for Darkangelchick

Hey guys I have to create a python version of Tic Tac Toe, but does anyone know if it's possible to make this using Tkinter? I think I have to have it nice and bright and colourful, therefore TKinter is the only solution i can think of using Python. Any …

Member Avatar for woooee
0
651
Member Avatar for mannclay

Hello, I am trying to make a desktop icon for a newbie script I wrote while Teaching myself Python. I wanted it to be a clickable desktop icon for OS X. Plus, I guess I can use Icon Composer to make it a pic. Any ideas?! Thanks...

Member Avatar for mannclay
0
84
Member Avatar for leegeorg07

hello, i just started a paper round and ive started doing what i do best : obsessing about it and i want to know if there is any way that i can open and close images of the different newspapers to learn them? i would prefer to do this with …

Member Avatar for leegeorg07
0
316
Member Avatar for andy121

There is a html page that has a form on it, with a text field named "text". When you enter text into that that field and submit it, it goes back to the python server, gets processed, and a new html page is sent out in response. I'm working with …

Member Avatar for alc6379
0
151
Member Avatar for schuerm

Hi I am desperately trying to get the text from a chat window. My idea was to use win32gui.GetWindowText(). I wrote a program to display any text with win32gui.GetWindowText() by iterating over all past and previous handles and as deep into each handle as there are children. Basically I tried …

Member Avatar for jworld2
0
397
Member Avatar for daniwebnewbie

I'm writing an application that needs to store a ton of objects and some attributes. I was wondering, based on python's inner workings, if it's more memory efficient to have one huge dictionary or many small dictionaries and then one dictionary that just references the smaller dictionaries? Any information would …

Member Avatar for paddy3118
0
261
Member Avatar for jascase901

Hello python is my first language, and i have read 1 book on it and gone through a tutorial, but i still don't feel like i have a firm grasp on python. I hear the best way to master a programing language is to actually program. So i want to …

Member Avatar for lllllIllIlllI
0
161
Member Avatar for docaholic

[ICODE]def selsort(l): if len(l)<=1: return l else: for i in range(len(l)): selsort(l[1:]) [/ICODE] Hey guys, this is what I have so far. I have trouble understanding recursion. Anyone know how to use it to do selection sort?

Member Avatar for Dhaneshnm
0
294
Member Avatar for FengG

I tried really hard on this one, finally came up with this, however, there's space between every number in my result because of the code 'print xxx,' , I want to find a way to delete those spaces. Program: let user enter say 555-GET-FOOD, convert it to 555-438-3663 [CODE]alph = …

Member Avatar for FengG
0
6K
Member Avatar for shailev

hi! i want to write a ftp server. i started writing: [CODE] from socket import * server= socket(AF_INET, SOCK_STREAM) server.bind(("0.0.0.0", 21)) server.listen(5) while(1): (client_s,client_addr)=server.accept() command=client_s.recv(1000) print command client_s.close() [/CODE] i run it and wrote in the internet explorer: [url]ftp://localhost[/url] but nothing happen.. it doesnt print the recieved command. what can …

Member Avatar for Gribouillis
0
57
Member Avatar for daniwebnewbie

Hi. I just started python programming tonight and am trying to use good practices such as list comprehensions etc. However, I'm trying to get a list of all files in a directory (and subdirectories) and only add the filename to my list if its extension matches one of the extensions …

Member Avatar for daniwebnewbie
0
151
Member Avatar for crumpet

Hi folks, Just hoping someone can point me in the right direction with this one. Say I have these key:value pairs in a dictionary, d1: [CODE="Python"] d1 = {fruit:['apples', 'bananas','oranges','tomatoes'], vegetables:['carrots','lettuces']} [/CODE] And I wanted to remove a list (containing tomatoes, oranges) from the value of the key fruit and …

Member Avatar for daniwebnewbie
0
140
Member Avatar for devstudio.2007

Dear All, Everytime i want to logg off or restart to set python path so how to avoid this logg off or restart options. Actually iam using two Softwares using this different Pythonpath if iam using second software means again i want to restart Pc how to avoid this Situation. …

Member Avatar for sneekula
0
105
Member Avatar for tehbrozor

hi, Im running debian/ubuntu linux and am trying to get a script/module that runs each time python is called from terminal. I am trying to write scripts that use Scipy,numPy,pyLab, etc and am trying to have all those packages import automatically each time python starts. I am not new to …

Member Avatar for tehbrozor
0
133
Member Avatar for dilipkk

Hi, I am downloading url using urllib2, the problem I am facing is some times server goes down and then read will take indefinite time. I dont want that, I want to raise a exception after 20 secs in this case. There is solution using signal.alarm but it works only …

Member Avatar for dilipkk
0
4K
Member Avatar for ls129

Hello Python gurus! I need to subclass the built-in type "int" and to add a method that resets the value to what it was when the class was first instantiated. here is what i want to achieve: a = my_int(4) print a ---> prints 4 (works ok) a += 5 …

Member Avatar for Gribouillis
0
167
Member Avatar for lakhan.p
Member Avatar for amarmasic21

I would appreciate any help with the following exercise, I have no idea how to really start this it'd not like any of the previous exercises I've done so any help would be great :) Define a class Set that keeps track of a collection of distinct objects. Inernally, you …

Member Avatar for woooee
0
152
Member Avatar for fuatm16

Hello All ! I m writing a scanner in python. I ve achieved to write scan results into a word file. But still not achieved to view results in my text box. My Text Box Codes: ----------------------------------------------------------------------------------------- metin = Text() metin.place(relx=0.3, rely=0.4, width=300, height=300) ----------------------------------------------------------------------------------------- A part of my Scanning …

Member Avatar for woooee
0
331
Member Avatar for lakhan.p

file f:\\pulldpto.ini hold following data... 101;Activaciones;Virginia Aláez;C/ Isabel Colbrand, 22 , Edif D Planta 4º ;28050 ( Madrid) what will be out put of variables. [python] fINI='f:\\pulldpto.ini' fINI=open(fINI,'r') while 1: linea=fINI.readline() if not linea:break linea=string.split(linea,';') variabl1[string.strip(linea[0])]=0 variable2[string.strip(linea[0])]=string.strip(linea[1]) fINI.close() [/python]

Member Avatar for woooee
0
83
Member Avatar for Gribouillis

Consider the following script [code=python] #!/usr/bin/env python # foo.py import sys print sys.argv [/code] When I run this in a terminal with arguments, here is the output [code] $ ./foo.py -h hello -m "this is a string" ['./foo.py', '-h', 'hello', '-m', 'this is a string'] [/code] My question is: is …

Member Avatar for Gribouillis
0
168
Member Avatar for karenmaye

Does anyone here have a wxPython code that converts a folder of images to a .wmv file just by clicking a button? What I did in my program was I load an Image-to-Video Converter Software by clicking a button but I feel that it would be better if I can …

Member Avatar for sneekula
0
2K
Member Avatar for JeyC

What is the easiest way to search a text file for a particular string? I have text files resembling the following : FILE A HAS 2266 LINES OF WHICH 951 WERE IGNORED FILE B HAS 2193 LINES OF WHICH 878 WERE IGNORED THERE WERE 2 DIFFERENCES Can anyone help me …

Member Avatar for JeyC
0
122
Member Avatar for alicem

Hello, I have just started learning Python. Please can you tell me if there is a way to read in a file one bit or byte at a time (i.e. in binary). Thank you!

Member Avatar for jlm699
0
6K
Member Avatar for harrykokil

is pygame used for games only? or it is used for some application like traffic simulation? can we produce a slide bar in pygame?

Member Avatar for lllllIllIlllI
0
86
Member Avatar for artemis_f

Hi I was just wondering if anyone knows/ can recommend books on wxPython? Of course quite a few come up on Amazon when I do a search but I was wondering if someone here has used a wxPython book and found it particularly helpful? Thanks

Member Avatar for lllllIllIlllI
0
128
Member Avatar for leegeorg07

a while ago i asked for help with a web crawler and i got it, but now in the air cadets we are looking at the history of the raf and i wanted to know if there is any way i can edit the code below to search for sites …

Member Avatar for lllllIllIlllI
0
108
Member Avatar for ask2

Hi I am trying to process a large text file. I would like to include parameters at some places in the file. Run it through python and write out the "processed" file with the values of the parameters in the new file. Example: original file: a =1 b=2 c= param1 …

Member Avatar for ask2
0
188
Member Avatar for wc26482

HI, Please could anyone advise me how to average a series of grayscale images using python. I trying to automate this process as I have thousands of images to average. Thank you

Member Avatar for slate
0
48
Member Avatar for alicem

The data is stored as an array with each element being an 8-bit binary number. I know this seems like a simple question, but I've looked and can't seem to find a simple answer on how to do it anywhere.

Member Avatar for slate
0
67
Member Avatar for chebude

I am stuck with large text files which I have to merge and further work with my model. I tried to follow the previous thread in text merging [url]http://www.daniweb.com/forums/thread38625.html[/url] Here is the script which I used: [CODE= python] one = open("one.txt",'r') two = open("two.txt",'r') ofh = open("out.txt",'w') # read in …

Member Avatar for chebude
0
137
Member Avatar for tillaart36

In a bigger program I made I need to be able to generate a grid with n rows and m columns. After that I need a function that will let me rotate this grid and with it rotate the values of the original grid. This is the code that let's …

Member Avatar for tillaart36
0
269
Member Avatar for abczxy124

As part of a project I need to draw a fence on turtle graphics that incorporates a loop. Can someone help me with the code I will need!!

Member Avatar for leegeorg07
0
49
Member Avatar for siddhant3s

Well, first of all I will speak much so that you guys can target my problem better. Hello, I am a poster from the C++ forum. Hence, I am a well established C++ programmer. Now I want to learn Python. First of all, should I? I mean, keeping in mind …

Member Avatar for sneekula
0
773

The End.