15,175 Topics
| |
hi friends, I am building a small web application for linux in python lang. I am using httplib for the web interface. and currently i using the following exceptions in httplib. [QUOTE] httplib.HTTPException socket.error socket.herror socket.gaierror socket.timeout [/QUOTE] so i need error codes and descriptions for the exceptions. I have … | |
Sorry guys had to change threads name seeing that NO1 showed an interest in the beginner thread. Hope someone out there has some material that will be helpful. I just went through some python coding and tutorials lately. For me I am going to use python in a database environment, … | |
Hi there, I would be very appreciative if someone could help me get my plots to work. I am plotting a y-variable against time, but on the x-axis the time tickmarks labels overlap. I have tried using the autofmt_xdate but it does not solve this problem in this case - … | |
Hi guys, this is probably a very basic question so excuse me for that. In java you can say: [CODE]Instance instance[] = new Instance[6] for (int i =0;i<6;i++){ instancei[i]=new Instance(...) [/CODE] Or basically declare lots of instances very quickly. In python is there an equivalent where I could write: [CODE] … | |
Hi, I am a total noob... I'm looking for a way to search a directory for config files and search each file for an entry that includes '1-' (bug apparently prepends this randomly) and delete that pesky 1- and save the file (on ubuntu). Any help or suggestions would be … | |
I'm using the code module to add an interactive interpreter to an object. This object has an interact method that when called creates an interactive interpreter with the object's dictionary as the namespace for the interpreter. When done interacting with the object, I want the "exit" function to return execution … | |
I'm new to python, and have just recently started using it as a means to circumvent my lack of calculus knowledge when performing physics equations. The problem I'm working on now is fairly simple, but I'm getting a bizarre syntax error I don't understand. Here's my code: [CODE]## Introduction ## … | |
Okay, all I want to do for now, is create a rather simple python interpreter. I have already created a simple command prompt for windows, utilizing the os module, the script's code is here: [CODE]import os os.system("title Command Prompt") while True: osc = raw_input(os.getcwd()+">> ") if osc == "exit" or … | |
class Toy(object): def play(self, toy): ''''Print squeak''' print 'Squeak!' class Dog(object): def __int__(self, name): '''Name a dog''' self.name = name def call(self, shout): '''Return true if shout is exactly 'Here, n!', otherwise return False''' return shout == 'Here, ' + str(self.name) + '!' def play(self, toy, n): '''Print 'Yip! ' … | |
im asking w input() for user to input "spelling words" for a kids homework, and i want it to append or add the words entered into a list. i got it to ask for user input for the words, but not sure how to make it add them into a … | |
Okay, I'm creating a game where you are a red circle on a black background, and you can move it around the screen, and you have to pick up the other dots. It's more complex than that, but I seem to be having an issue. Some dots will go away … | |
Well, couple days ago I've red in some thread in daniweb, which I was thinking in a solution for it. So the problem is Linux has got the speech recognition, El Duke was trying to find something like windows speech recognition for Linux. As Mathhax0r and vagaseat said, there isn't … | |
Hi! I have a problem. How can I inport, numbers from a txt document and make a math operation with them. I have to transform the cotent of the document into a lists? Lets say this is the content of the file: 44 36 11 66 24 92 3 8 … | |
Hi, I'm trying to match patterns of the types sentence1 = "keywords=walter&keywords=scott" sentence2 = "keywords=john&" sentence3 = "keywords=james&keywords=john&keywords=brian&" so basically the keywords=somestring& part can be repeated once or multiple times. I am trying to extract the string(s) between '=' and '&'. I have come up with the following so far. … | |
I am a linux newbie and I am wondering why some software developed for python is usually installed by doing "python setup.py install". What is it doing? what is the different of this comparing to "compile from source"? For instance, a package in this form: numpy-1.3.0.tar.gz I was told by … | |
Hi, I'm trying to use regular expressions on a log file and am trying to extract search terms. Each line in the file is of the form: [CODE]mystring = "00:00:11 192.168.21.44 GET /images/help.gif - 200 Mozilla/4.0+(compatible;+MSIE+5.0;+Windows+98;+DigExt) ASPSESSIONIDGGGGGQEG=CLDIHIJBJAPFAGBFIOMCFGGA;+PRO%5FOnline=SEARCHQUERY=%09%3Cinput+type%3Dhidden+name%3D%27HrowColumns%27+ID%3D%27HrowColumns%27++value%3D%271%3B6%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27txtScopeData10%27+ID%3D%27txtScopeData10%27++value%3D%27[COLOR="Red"]catherine[/COLOR]%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27txtScopeData30%27+ID%3D%27txtScopeData30%27++value%3D%27[COLOR="Red"]porter[/COLOR]%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27txtScopeData50%27+ID%3D%27txtScopeData50%27++value%3D%27%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27txtScopeData11%27+ID%3D%27txtScopeData11%27++value%3D%27%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27txtScopeData31%27+ID%3D%27txtScopeData31%27++value%3D%27%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27txtScopeData51%27+ID%3D%27txtScopeData51%27++value%3D%27%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27HCollection%5Fid%27+ID%3D%27HCollection%5Fid%27++value%3D%271%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27Submit1%2Ex%27+ID%3D%27Submit1%2Ex%27++value%3D%2736%27%3E%0D%0A%09%3Cinput+type%3Dhidden+name%3D%27Submit1%2Ey%27+ID%3D%27Submit1%2Ey%27++value%3D%2718%27%3E%0D%0A http://www.foo-bar.com/SearchResult.asp"[/CODE] I have put the search terms that I'm trying to extract above … | |
Regex is one of the more complicated modules that you can use in python. Once you have learnt it though you can use it many different programming languages, so its a useful tool for using with strings. So first to use regex you must import it [code] import re [/code] … | |
im new to python, been working in php largely in the past, but wanted to learn something new and different. as such, i want to use python to create webpages, but have been tinkering in the IDLE until now... when using php, I use a local install of WAMP... is … | |
Hey guys, I have a already written package in python2.5.1 for windows,it includes wxpython biopython1.44 modules and now i want to transfer it to unix server,is there any way i can do that or i have to write that functions again...\ Thanks in advance Prankyrules | |
Hi there i am new at OOP and i want learn about it. I start with the book how to think like a computer scientist but at the ending chapters i get lost .... Can some one advice me a good book that covers OOP ?with good examples,diagrams e.t.c. | |
Hello. I would like to open and read OO Writer. I used the script: [file = open('myfile.odt', 'r'] [lines = file.readlines()] [file.close()] [for i in lines: print i] I get some strange characters. I had write 'rb', instead 'r', but it did not work. I have copied a ODT file … | |
Alright guys so I have a little problem with a nested list. so here is my list: [code=python] a = [[1,2,3], [4,5,6], [7,8,9]] #I know that I can do for example a[0][0] and that will return the first value in the first nested list but I don't know how to … | |
Hi, My code requires to send an email to list of people that satisfy certain conditions. This email will in turn have a hyperlink to open another email,with subject and body pre populated. When I try creating this hyperlink, i want the code to be hidden ie. i want to … | |
Hey, I'm trying to make a program restart if a function (in this case playAgain) is true. Is there a simple way to do this? Here's the end of my program: [CODE=python]theGame() if playAgain() == True: else: quit()[/CODE] | |
I have a little program that goes to news aggregater's, gets the hrefs, and returns in a window. I want to have multiple windows open if multiple sites are choosen, right now, it will only go to the first one in a list, and completes perfectly. I assume I am … | |
how could I make the function count?.. its a test marked out of 5, so if the user enters 1,1,2,2,4,5, then the output= 2 people got 1 mark, 2 people got 2 marks and 0 got 3 marks and so on?... i dnt knw if my code is even right.. … | |
response = urlopen("https://www.lingq.com/accounts/login/") #response = urlopen("http://www.google.com.vn") window = ParseResponse(response) window.document # HTML DOM Level 2 HTMLDocument interface forms = window._htmlforms # list of objects supporting ClientForm.HTMLForm i/face form = forms[1] print form #print form control = form.find_control("password") form["password"] = 'password' control = form.find_control("username") form["username"] = 'username' response2 = urlopen(form.click()) for … | |
I try again in a new thread, the other went out of hand. I use this code line to create a n value. n = random.randint(0, 99), i use this n value as a lap index to my while loop. The loop is in a function called "def run(self)" in … | |
I'm just wondering if it is possible to import a module as an object attribute. The basic description of what I want to accomplish is that I'm creating a software agent object. This agent will have a set of abilities (functions), but I don't know what these are ahead of … | |
Hi,there, assert pop == "berg", "Item removed from the stack was not \"berg\"." why using '...' can avoid syntax error ? Thank you :) |
The End.