1,175 Posted Topics
Re: So, what are your errors? | |
Re: I can see one problem, tickerhtml=urllib2.urlopen(ticker) needs to be: tickerhtml=urllib2.urlopen(ticker).read() | |
Re: The power drinks that you can get in many stores here can have up to 800 mg caffeine in them, and some students swig down 2 or 3 of those before an exam. That would be the equivalent of 12 - 15 cups of coffee! They fail the exam because … | |
Re: People were as foolish 5 thousand years ago as they are now. My proof that there is no evolution. | |
Re: The Bible is full of rules to live by, not secret code! If someone claims to have discovered secret code, then it is only to pull ignorant folks nose for financial gain or influence peddling. | |
Re: Python is not using 100% CPU time, your program is. Without some code it will be hard to help. | |
| |
Re: Clear clears the canvas not the panel. Your listbox is on the panel and not the canvas. If you want to clear the listbox, use self.process_list.Clear() | |
Re: [QUOTE=ithelp;881579]I heard there is empty space inside nucleus of atoms , I guess there will many such example of empty spaces.[/QUOTE]What keeps this space from collapsing? There must be something there! | |
Re: Looks like you could simplify your code a little: [code=python]data = """\ <SYNC Start=5047><P Class=ENCC> Back, back, back, back! <SYNC Start=7235><P Class=ENCC> <SYNC Start=10725><P Class=ENCC> Yeah, Dan!""" # this would be like the file data lines = data.split('\n') new_data = "" for line in lines: if not line.startswith('<'): new_data += … | |
Re: Hey, don't be sorry, it's a great approach to a quiz. Now you found out that dictionary keys have to be unique. So, what did you do to correct this? | |
Re: You can use Google Groups to check your favorite newsgroup: [url]http://groups.google.com/group/alt.models.railroad.ho/topics?lnk=srg[/url] | |
Re: ararik, please do not double post! You are almost there, as slate says, simply sum up word counts and word lenghts: [code=python]myfile = open(filename, "r") wordcount_sum = 0 wordlength_sum = 0 for line in myfile: words = line.split() # sum up the word counts wordcount_sum += len(words) for word in … | |
Re: My neighbor was kind enough to look the other way, as I picked a bunch of flowers out of her garden to bring to mom. | |
Re: I am thinking of the old time machine story, where people rather than pigs were raised for food. | |
Re: You might be thinking about something like this: [code=python]# a wxPython frame full display-screen size # position widgets in the center import wx class MyFrame(wx.Frame): def __init__(self, parent, mytitle, mysize): wx.Frame.__init__(self, parent, -1, mytitle, size=mysize) # the panel is needed for proper positioning panel = wx.Panel(self) panel.SetBackgroundColour("green") w, h = … | |
Re: I guess you can play around with lists and lists of lists. For example: [code=python]# create a 2D matrix of zeros and populate it def make_list(size): """create a list of size number of zeros""" mylist = [] for i in range(size): mylist.append(0) return mylist def make_matrix(rows, cols): """ create a … | |
Re: The wx demos sugg because there is too much code bloat! You may be able to figure it out anyway. BTW, your console code could stand major improvement. | |
Re: Google uses C++ for speed of execution and Python for speed of development. They make a good pair. | |
Re: You can use string slicing if you assume a few things: [code=python]#!/usr/bin/env python # has old = "AND Category 07|Spec 01|ABC 01 AND Category 07|Spec 02|XYZ 02 \ AND Category 07|Spec 03|PQR 03 " # wants new = "AND Category 07|Spec 01 AND Category 07|Spec 02 AND Category 07|Spec 03" … | |
Re: Try something like this: [code=python]try: lightblue.obex.sendfile(device.getAddr(), c[1],"advertisement.jpg") except lightblue._obexcommon.OBEXError, error: if error.args[0] == 111: print "Connection refused!" elif error.args[0] == 11: print "Resource temporarily unavailable!" else: pass [/code] | |
Re: [QUOTE=Ancient Dragon;862360]Nice, but don't walk around their lawn in bare feet :) If you have ever stepped on a wet pasture pattie with bare feet then you know what I mean.[/QUOTE]It soothes sore feet! BTW, goats love beer! [url]http://www.roadsideamerica.com/story/2227[/url] | |
Re: Look into Python modules audioop and sunaudiodev Sun's .au audio file format is rather simple and flexible. Here is an example that vegaseat left some time ago, it shows you how to create an .au files from scratch: [code=python]# create a soundfile in AU format playing a sine wave # … | |
Re: The easiest way is to use a wx.RadioBox: [code=python]import wx class MyFrame(wx.Frame): def __init__(self, parent=None): wx.Frame.__init__(self, parent, wx.ID_ANY, size=(300, 160)) # match to the number of radiobuttons self.mychoices = ['image1', 'image2', 'image3', 'image4'] # create a box with 4 radio buttons, no labels here label_choices = [' ', ' ', … | |
Re: The easiest way is to create a dictionary where the key is the (x,y) location tuple and the value is the (r,g,b) color tuple of the pixel: [code=python]#!/usr/bin/env python # image data analysis using PIL, keep track of pixel value # (r,g,b) and location (x,y) with a (x,y):(r,g,b) dictionary from … | |
![]() | Re: The simplest way is to use Python's built-in rot13 encoder. Write one program to give you the encoded password: [code=python]# program to rot13 encode a given password, here 'nixon' # copy the result into your program that needs this password # and then use encode('rot13') to match user password password … ![]() |
Re: Portable Python installs a portable version of Python right on an inexpensive USB flash drive (plan on 150MB for each version). You can use the flash drive now on Windows computers that do not have Python installed. It comes in Python25, Python26 and Python30 flavors. See: [url]http://www.portablepython.com/releases/[/url] In your case … | |
Re: Can be as simple as: [code=python]pw = "pass word" pw = pw.replace(" ", "") print(pw) # --> password [/code] | |
Re: I find designers rather cumbersome, they throw in more code than you want to have, and you have a much harder time fleshing out to working program. You are better off collecting a set of working templates of the various widgets you are interested in, and copy and paste from … | |
Re: If you want to import custom module xyq via the Pythonpath create a file xyq.pth and stick it into a directory python will look into, like for Windows: C:\Python25\Lib\site-packages for Linux: /usr/lib/python2.5/site-packages The .pth file contains a line showing the directory in which module xyq is located, for instance: for … | |
Re: If you want to show friends some of your great Python programs, I recommend this approach: Portable Python installs a portable version of Python right on a small and inexpensive USB flash drive (plan on at least 150MB). You can use the flash drive now on Windows computers that do … | |
Re: Tuple elements can be accessed by their index: [code=python]my_tup = ('fdasf','dfasf','asdf') print my_tup[0] # --> fdasf print my_tup[2] # --> asdf [/code] | |
Re: You could do something like this: [code=python] prompt = "Enter your five character user ID; " user_id = 'THE' + raw_input(prompt) [/code] | |
Re: Python code can be written so it almost reads like pseudo code: [code=python]word = "Apple" # create an empty string new_word = "" # iterate through word one character at a time for c in word: # check if c is already in new_word if c not in new_word: new_word … | |
Re: Does your book "Programming in Python 3" refer to Python version 3.0 or is it simply the third edition of the book? If it refers to version 3.0+ then the sample code is buggy! | |
Re: Do get an understanding girlfriend you need to join a local church. She will teach you good manners and good English. | |
Re: There might be something wrong with your boot order. Here is the spiel from the Ubuntu site: 1. Restart your computer with the CD still inserted in the drive 2. When the computer restarts, look very carefully at the initial screen it shows. Look for an option such as <F10> … | |
Re: [QUOTE=jbennet;776971]i would rather coal ash than radioactive sludge lol[/QUOTE]Yeah, all that arsenic, cadmium and lead in coal ash is good for the neighbourhood! | |
I have an HP DV9000 notebook with Vista, and created a Knoppix 6.1 live Linux Flashcard. I can boot it up and select Linux, but the 'wirless' switch will not activate, even so physically it is in the on position. It almost looks like there is a software( HP Wireless … | |
Re: Python is a modern language that has borrowed advanced programming concepts from a number of other languages like C++, Java, Lisp and Haskell. It would be very hard to express these in C. | |
Re: On problem #1 you are a little messed up. You need to send a list of elements to the your function that contains elements that the len() function can be applied to, like strings for instance. Then you return a list of these lengths. BTW, do not use 'list' as … | |
Re: Looks like one of those made up news stories that fill in when there isn't much news. Wonder what will happen to all those kids who were name 'George Walker Bush' by their excited tax-relieved parents. | |
Re: Two things: 1) Separate the code that goes into the loop from code that does not loop by using proper indentations 2) Unless this is an exercise in writelines(), it is better to build a temporary string with the names entered in the loop, and then write that temporary string … | |
I just bought an inexpensive used Dell notebook that has Ubuntu/Linux as an operating system. Compared to Vista this is sweet. It came with Python25 installed, but it was easy to use the Add/Remove application feature to get open source software from the Ubuntu site. I downloaded/installed Stani's Python Editor … | |
Re: You could insert the length of your secret message string as the first value. | |
Re: I played with it a little, but I am not sure about the complete algorithm. This is as far as I came: [code=python]# use linear and quadratic probing to find collision in an integer list # incomplete: # function quadratic_probe() needs to get all index values!!!! import random def linear_probe(n, … | |
Re: There are at least two ways to write this. The first example puts the condition to not exit the while loop into the while statement: [code=python]n = 1 while n != 0: try: # works on Python2 and Python3 versions n = int(input("Enter a number (zero to exit): ")) print("You … | |
Every now and then Vista comes up with a "Program Compatability Assistant" popup window (see image) when you want to run a .exe file. If you make the mistake, like I did, and agree with the Administrator option, then from hence foreward everytime you want to run this particular executable … | |
What do you think about bailing out the top slime at the banks, so they can carry home their million dollar bonuses at taxpayer's expense? |
The End.