1,175 Posted Topics

Member Avatar for The Dude
Member Avatar for sneekula
0
25
Member Avatar for vegaseat

I am using Clisp free from: [URL]http://sourceforge.net/projects/clisp/[/URL] [php] (format t "~%~S from DaniWorld!~%" "Hello world") [/php]

Member Avatar for sgssergio
0
1K
Member Avatar for Matt Tacular
Member Avatar for vegaseat
0
288
Member Avatar for iamthwee

There is 'Starting Python' right here to give you a taste: [URL]http://www.daniweb.com/techtalkforums/thread20774.html[/URL] A good starter tutorial: [URL]http://bembry.org/technology/python/index.php[/URL] Another good starter tutorial: [URL]http://www.ibiblio.org/g2swap/byteofpython/read/[/URL] And of course there is always the latest update: [URL]http://www.python.org/doc/current/tut/tut.html[/URL] Now watch out, Python takes an open mind and is addictive!

Member Avatar for Ene Uran
0
697
Member Avatar for jwjazz

You figured it out! [code=python] print 011 # --> 9 (the denary for octal 011) print 0xff # --> 255 (the denary of hex ff) [/code]

Member Avatar for sneekula
0
111
Member Avatar for jwjazz

I think there is a logic flaw in either code, since you are not using the result of the recursion call. It seems to pile up in a return stack somewhere! If you uncomment Bumsfeld's internal print statement, it will print a whole bunch (counted 31) of sixes

Member Avatar for jrcagle
0
137
Member Avatar for leonardo01
Member Avatar for Jellomaster
Member Avatar for sneekula
Member Avatar for sharma_vivek82
0
196
Member Avatar for bkerr06

One of your problems is right here: [code] if (winsA) or (winsB) == ((n / 2) + 1): break [/code]You have to change the if statement logic a bit, and you are using break when you are clearly not in a loop.

Member Avatar for liz517
0
812
Member Avatar for liz517

I didn't have a file, so I used just a text string for testing, but here is one way you can solve this: [code=python]text = "I love to work, but not paying my taxes!" # text to word list words = text.split() print words # testing the word list # …

Member Avatar for sneekula
0
124
Member Avatar for sneekula

The last time I posted a question here, I got a rather nasty response, so please just constructive stuff! I want to make a scrollable entrybox for Tkinter GUI, the scrollbar shows up and works, but text does not move. Am I missing something? [code=python] import Tkinter as tk root …

Member Avatar for sneekula
0
758
Member Avatar for sneekula
Member Avatar for aot
0
3K
Member Avatar for sneekula
Member Avatar for vegaseat
0
118
Member Avatar for mattyd

I was just playing around with a matrix the other day and found out this: [code=python]# create a 10 x 10 matrix of zeroes matrix10x10 = [[0 for col in range(10)] for row in range(10)] # fill it with 1 diagonally for i in range(10): matrix10x10[i][i] = 1 # show …

Member Avatar for jrcagle
0
441
Member Avatar for sneekula

I know that you can do integer calculation in Python with astronomically large numbers. What is the precision limit when using floats?

Member Avatar for vegaseat
0
165
Member Avatar for sneekula

I know you can get the present time this way: [code]import time now = time.asctime(time.localtime()) print now # Mon Feb 19 10:41:32 2007 [/code]How can I make sure that 'now' does not fall on our lunchtime break, let's say 11:30AM to 12:45PM?

Member Avatar for sneekula
0
161
Member Avatar for fonzali

You also complicate your code (and life) by switching to OOP, when python gives you the freedom not to do that with simple programs like that.

Member Avatar for sneekula
0
161
Member Avatar for sneekula
Member Avatar for sneekula

This could be a cooking recipe, but in my case it is a chemical recipe. Here is a typical generic chemical recipe: 23 g chemicalA is dissolved in 250 ml methanol. The solution is cooled to 0 - 5 degC and 18 ml compoundB is added dropwise over 60 minutes. …

Member Avatar for jbennet
0
212
Member Avatar for sneekula

Is there a way to preselect/highlight a listbox item with the Tkinter GUI toolkit at the startup of the program without clicking the mouse on it?

Member Avatar for sneekula
0
1K
Member Avatar for Matt Tacular

[quote=Infarction;313071]I'd go the other way (int to char) so you don't lose data if the int value is >= 256...[/quote]You could use RUBY then you don't have to worry about silly issues like that.

Member Avatar for ~s.o.s~
0
92
Member Avatar for Shark7

You can also use module numpy: [php]import numpy v1 = numpy.array([1, 2, 3, 4]) v2 = numpy.array([4, 3, 2, 1]) # product print v1*v2 # [4 6 6 4] # scalar product print numpy.add.reduce(v1*v2) # 20 [/php]Numpy is a free high speed numeric extension module used by engineers and scientists.

Member Avatar for Shark7
0
355
Member Avatar for bumsfeld

This re stuff makes my head spin! I can see that it is very powerful for text processing, but also seemingly very complex! Almost another language within Python.

Member Avatar for bumsfeld
0
1K
Member Avatar for sneekula

I keep reading threads here, some use the Tkinter GUI toolkit and others use the wxPython GUI toolkit. Why would one use one or the other?

Member Avatar for sneekula
0
1K
Member Avatar for Matt Tacular

[quote=Matt Tacular;306575]In python if I divide 6/3 I get 2, that's fine. But I divide 6/4 and get 1... Why aren't I getting a decimal? I would like to know because I want to make something that can detect wether or not a number is whole. (I need help with …

Member Avatar for Matt Tacular
0
108
Member Avatar for sneekula

The department's computer has Python 2.4 and on my home computer (really my dad's computer) I installed Python 2.5. Is it possible to have Python 2.4 and Python 2.5 on the same computer?

Member Avatar for vegaseat
0
114
Member Avatar for sneekula

Since there is so much discussion on one of the threads on zipping/unzipping files and all the associated incompatibilities, is there a way to do this with Python and cut out the middleman?

Member Avatar for vegaseat
0
136
Member Avatar for jrcagle

[quote=vegaseat;302724]Looks like Ghostdog is right ... [code=Python]# test sample from user input months = ['Dec', 'Jan'] # test sample from os.path.walk() files = ['FebWork1,dat', 'JanWork3.dat', 'DecWork7.dat'] # test dates = [] for i in files: for j in months: if j in i: dates.append(i) break print dates # ... or …

Member Avatar for jrcagle
0
140
Member Avatar for sharma_vivek82
Member Avatar for Extremist

I your interest should be in chemistry, write a chemical structure drawing program, that displays bondenergies and charge intensities of the molecule.

Member Avatar for jrcagle
0
329
Member Avatar for mattyd

I have used DrPython for a while now and really like it! Comes in Windows and Linux versions. It has clean displays and a minimum of quirks (does not like foreign characters). There are lots of configuration options. The results are displayed in an output window, and you can select …

Member Avatar for Ene Uran
0
200
Member Avatar for sneekula

I know that one has to be careful with mutable arguments like lists applied to function calls, so that things like this won't accidentally happen: [php]def add_item(list2): list2.append(99) return list2 list1 = [1, 2, 3] list3 = add_item(list1) print list1 # [1, 2, 3, 99] oops! print list3 # [1, …

Member Avatar for jrcagle
0
230
Member Avatar for sneekula

I took a mixed type list and set out to find the min and max values. The results are very surprising to me: [php]mixed_list = [11, 'Dick', 12, 'Mary', 7, 'Zoe', 9, 700, 777, 'Paul', 13456789] mn = min(mixed_list) mx = max(mixed_list) print mn, type(mn) # 7 <type 'int'> print …

Member Avatar for vegaseat
0
3K
Member Avatar for sneekula

I was experimenting with the nested list example in thread: [URL]http://www.daniweb.com/techtalkforums/post246791-72.html[/URL] and was trying to search a nested list like that: [code]nested_list = [1 ,'Dick', 2, ['Mary', 7, 9, [700, 777, 'Paul']], 13] if 'Paul' in nested_list: print 'found Paul' else: print 'Paul not found' [/code]It always tells me that …

Member Avatar for vegaseat
0
106
Member Avatar for sneekula

I want to make a Tkinter button respond to a left and right mouse click differently. How can I do this?

Member Avatar for vegaseat
0
8K
Member Avatar for sneekula
Member Avatar for sneekula
Member Avatar for sneekula
0
12K
Member Avatar for chris99

[quote=Ene Uran;289138]Also a word of advice: 1) start your class names with a capital letter 2) create class instances like: main = Main(root) child = Child() 3) now you can get rid of the globals by associating the variables properly to the class instance via self. or the instance name.[/quote]Maybe …

Member Avatar for chris99
0
1K
Member Avatar for mattyd
Member Avatar for babutche

As far as I know in the US all the states and capitals are unique. Since your are entering the state and want to find that capital, Ene's solution will be the easiest.

Member Avatar for babutche
0
6K
Member Avatar for sneekula
Member Avatar for Ene Uran
0
13K
Member Avatar for mattyd
Member Avatar for sneekula
0
94
Member Avatar for sneekula

I like to create a database of common chemicals with Python. How would I go about that? Any help welcome!

Member Avatar for Ene Uran
0
119
Member Avatar for sneekula

This came up on Chris99's bus ticket program thread. Would like to see any simple examples on how to pass variables between classes without using global variables.

Member Avatar for vegaseat
0
19K
Member Avatar for sneekula

As you can see, I am playing around with the Tkinter GUI toolkit. How can I keep a number of widgets fixed in a location even when the user expands the window?

Member Avatar for sneekula
0
195
Member Avatar for sneekula

I am writing a small Python program for the use in our departments stockroom. This is what I have come up with (just starting): [php]# table of chemicals in stockroom # order --> stock number, chemical name, quantity (grams) # short version of the table table = [ ['ud-99137', 'm-chlorobenzoic …

Member Avatar for sneekula
0
155
Member Avatar for sneekula

Is there a way to make a Tkinter GUI window that the user can not change the size of?

Member Avatar for sneekula
0
162
Member Avatar for mattyd

I agree with Jeff! I have seen other computer language code like C, where the writer did not not use any indentation. Now you get lost in an ocean of { and } and ; which makes large code almost unreadable!

Member Avatar for jrcagle
0
244
Member Avatar for sneekula

I have a directory with many subdirectories. Each subdirectory contains a small number of image files (.jpg). I would like to accumulate all these image files in a Tkinter listbox, sort them and be able to select blocks of files and send them to another listbox. Ultimately I would like …

Member Avatar for Ene Uran
0
3K

The End.