4,305 Posted Topics
Re: As of this point in time, the only thing you can do is to use Python26 for the book. PIL sooner or later will appear for Python3. but don't hold your breath. When one third party module like cImage (which i think is just a rewrite of graphics.py with some … | |
Re: An interesting thread. Does she have something to hide in her medical records? They are not disclosed yet! | |
Re: Which of the 250 major computer languages are you learning? I need some idea so I can compare. | |
Re: i am sure that any good breathing exercises (fresh air) would to you a lot better. :) | |
Re: By default sort() sorts by the first item in each sublist ... [code]q = [[8, 9, 7], [1, 2, 3], [5, 4, 3], [4, 5, 6]] q.sort() print q # [[1, 2, 3], [4, 5, 6], [5, 4, 3], [8, 9, 7]] [/code] | |
Re: Your dog's tail is dogged and chewed, and not real. | |
| |
Re: For starters take a look at: [url]http://www.daniweb.com/forums/thread20774.html[/url] Some online books ... Swaroop C.H. has rewritten his excellent beginning Python tutorial for Python3: [url]http://www.swaroopch.com/notes/Python_en:Table_of_Contents[/url] "Dive Into Python" Mark Pilgrim's Free online book, novice to pro, is updated constantly, and has been rewritten for Python3 (check appendix A for Py2-to-Py3 differences) [url]http://diveintopython3.org/[/url] | |
Re: [QUOTE=ic_m;1241656]Need help to code a program which: - validate user input, accept values that a user has entered (ex, a, b, c, d, e) - any other values other than these are to be treated invalid with a message and block it from processing. - Prompt the user to enter … | |
Re: In your code the [COLOR="Red"][B]else[/B][/COLOR] pairs up with the [COLOR="Red"][B]if[/B][/COLOR] statement just before it. If you change that to [COLOR="Red"][B]elif[/B][/COLOR] it pairs up with the [COLOR="Red"][B]if[/B][/COLOR] before that. That's because all the conditional statements have the same indentation level. | |
Re: The wxPython manual states: Not all platforms support this function. | |
Re: [QUOTE](name, score) = line.split() scores[score] = name Why is the value "name" being placed into the variable [score]? It looks to me like it's just swapping places with name and score.[/QUOTE] Here scores is the name of the dictionary, score is the key and name is the value [B]mydict[key] = … | |
Re: The original code works fine with Python24 through Python31. The parenthesis, as tonyjv pointed out, are optional. | |
Re: William Gates' claim to the "Programmers Hall of Fame" is DOS, specifically MS-DOS for the the first IBM PC. I think that was written in assembler. It was a great achievement in those early PC days. This comes from a person who used some of the alternative disk operating systems. … | |
Re: thanks all. i need it ------------------------------- mini parts short sale listings Bullkaka signature spam! Stop it! | |
Re: My recommendation, don't work with an old ditty like module gasp. It is a wrapper for PyGame and doesn't work very well with newer versions of PyGame on Windows. I got it to go this way ... [code]# for Windows and Python26 dowmload and install gasp from: # http://edge.launchpad.net/gasp-core/0.1.x/0.2.0beta1/+download/python-gasp-0.2.0beta1.win32.exe # … | |
Re: What form do you want the birthdays in? Most like strings of form [B]mm/dd/yyyy[/B] | |
Re: [code]# naming a variable str str = "my string" # later calling function str() # will give # TypeError: 'str' object is not callable numeric = str(123) [/code] | |
Just spent about an hour removing [B]Antispyware Soft[/B], a small miserable program that comes in on e-mail or certain church sponsored web sites. It deposits a random named executable in your Windows OS (XP through Windows7) and then takes over the registry to a point where you can not run … | |
Re: Nice project! Are you hooked on Python yet? | |
Re: Which graphics toolkit are you using? Also need to see some code. | |
![]() | Re: For the sake of simplicity ... [code]def list_has_duplicate_items( mylist ): return len(mylist) > len(set(mylist)) def get_duplicate_items( mylist ): return [item for item in set(mylist) if mylist.count(item) > 1] mylist = [ 'oranges' , 'apples' , 'oranges' , 'grapes' ] print 'List: ' , mylist print 'Does list have duplicate item(s)? … |
Re: I used to do quite a number of automation projects going through the serial port. Alas, I am finding out that just about all the newer machines have done away with the RS-232 serial port. How does the USB port fit in with all of this? | |
Re: [QUOTE=ultimatebuster;1234283]You cannot distribute Qt software on Windows without a license.[/QUOTE]Really meant for commercial software only. | |
Re: To go from string [B]"+2x-1y+3x+2"[/B] to string [B]"5x-y+2"[/B] would have to be done by a specialized string parser following rules you set. Quite an interesting problem. | |
Re: The nice thing about using [B]raise SystemExit[/B] to exit your program is that you don't have to import anything extra. | |
Starting with version 2.6 Python has introduced a new container called the named tuple. You can use it similar to a class based record structure, but it has the memory efficiency of a tuple. | |
Re: A linear search goes through a sequence of items one item at a time from the start of the sequence until the item is found ... [code]sequence = 'abcdefghijklmnopqrstuvwxyz' search = 'z' for c in sequence: if c == search: print("found search item") break [/code]As you can see, if you … | |
Re: Hmm, maybe designing fashionable clothes for robots could be a new career? | |
Re: Go ahead and test it! If you can't live with the amount of protection given, use C++. | |
Re: There wouldn't be enough space inside any bus to post all the things that are prohibited. It would be much easier to post all the things that are allowed. :) | |
Re: Since this looks a lot like homework, please show us at least some coding effort on your part! | |
Re: I have seen this somewhere else ... [code]# use module pickle to dump and load complete objects # like dictionaries # modified to work with Python2 and Python3 versions import pickle catalog = { 1:["Bread", 1.50, 10 ], 2:["Cheese", 5.00, 5], 3:["Apple", 2.50,12] } # pickle dump the dictionary fh_out … | |
Re: Well, your mind seems to be made up, if you dislike Python, there isn't much I will do about it! Python is a tool, just like any other computer language. If you can't figure out any advantages, don't use that tool. Computer languages are tools that allow you to write … | |
Re: What you are creating is not an array, but an object called a string ... [code]my_array = 'a' for i in range(10): my_array = my_array + 'b' print my_array # abbbbbbbbbb print type(my_array) # <type 'str'> [/code] | |
Re: Code Snippets do not have questions associated. They are finished, working code. | |
Re: This shows you were to place random.shuffle() ... [code]""" knockknock.txt for testing: comback1,punchline1 comback2,punchline2 comback3,punchline3 comback4,punchline4 """ import random def main(): k = open("knockknock.txt", "r") line_list = k.readlines() print line_list # for testing only random.shuffle(line_list) print line_list # for testing only n = 0 while len(line_list)!=0: line = line_list[n] # … | |
Re: [QUOTE=Steven.T;1225633]Write a spell checking tool that will identify all misspelled word in a text file using a provided dictionary. The program will accept either one or two command line parameters. 1. The first command line parameter is the name of the text file that will be checked. 2. The optional … | |
Re: I am glad we brought this all out in the open! I like WaltP's RESPECT rules. | |
Re: [QUOTE]Weird thing is that if I put a GetLabel right after SetLabel I see the new value![/QUOTE] The combination most likely function as a Refresh(). I would just go with the combo since wx.Dialog() does not show a Refresh() method in the manual. You might have discovered a nice little … | |
Re: Another way you could approach this ... [code]matrix = [[0 for x in range(5)] for y in range(3)] for sublist in matrix: s = str(sublist) s = s.replace('[', '|').replace(']', '|').replace(',', "") print s print '+-'*5 + '+' [/code] | |
Re: Cow tipping, if done professionally, is quite relaxing for the cow. | |
Re: [code]# show the system path (aka. PYTHONPATH), a list of directories # that Python by default would look into # item at index 0 would be the working directory import sys print( sys.path ) """possible output --> [ 'D:\\Python26\\Atest26\\aatest26', 'C:\\WINDOWS\\system32\\python26.zip', 'D:\\Python26\\DLLs', 'D:\\Python26\\lib', 'D:\\Python26\\lib\\plat-win', 'D:\\Python26\\lib\\lib-tk', 'D:\\Python26', 'D:\\Python26\\lib\\site-packages', 'D:\\Python26\\lib\\site-packages\\PIL', 'D:\\Python26\\lib\\site-packages\\wx-2.8-msw-unicode' ] """ … | |
Re: Also [B]if hit=="Y" or "y":[/B] is just plain old wrong! Good luck with the exciting C# language. |
The End.