4,305 Posted Topics

Member Avatar for SitiSlicker

If you want to test what the module bisect suggested by our friend Gribouillis does, run a small program like this ... [code=python]# testing module bisect from bisect import bisect_left costs = [0.0, 2.10, 3.20, 4.70, 4.80] weights = [0, 2, 6, 10] # iterate through a list of possible …

Member Avatar for sneekula
0
2K
Member Avatar for Devlan

You are assuming the word at index in list 'a' makes sense with the word with the same index in list 'b'. Somewhat dangerous. It would be simpler to make a dictionary with a:b (key:value) pairs, this way things that belong together stay together. Also, dictionary searches are highly optimized …

Member Avatar for Devlan
0
168
Member Avatar for laspal

Something like this might do ... [code=python]# converted certain variables to strings for testing only data1= [['Contacts', 'company.contacts.count()'], ['Notes', 'company.notes.count()'], ['Met by', ], ['Industry', 'industry'], ['Financial Investors', '31']] data2 = [] for item in data1: #print item, len(item) # for testing if len(item) < 2: item.insert(1, 'missing value') data2.append(item) print …

Member Avatar for vegaseat
0
295
Member Avatar for sneekula

[QUOTE=Ene Uran;683833]If we call folks from Mexico Mexicans and folks from Canada Canadians, what do we call the folks that live in the good old USA? ......[/QUOTE]Yankee Doodles? Good question, since Americans would be inhabitants of the entire American continent. I demand congressional action to clear this up!!!

Member Avatar for Ene Uran
0
249
Member Avatar for bumsfeld

Henri, enjoyed your many posts in the Python section, congratulations on your first kilopost!

Member Avatar for GrimJack
3
200
Member Avatar for tb808kid

I think you need to give us just a little bit more information about your code. Mindreading is not everyone's talent.

Member Avatar for tb808kid
0
131
Member Avatar for lllllIllIlllI

I wouldn't go that way. OGL development and maintenace is pretty well dead. If you are interested in 3D graphics take a look at VPython.

Member Avatar for lllllIllIlllI
0
683
Member Avatar for lllllIllIlllI

If you installed the wxPython docs file, it could be in something like: C:\Python25\Doc\wxPython2.8 Docs and Demos\demo

Member Avatar for lllllIllIlllI
0
177
Member Avatar for iamgame

I think at one time you asked about module MD5 to send on a password, you might want to take a look at this post: [url]http://www.daniweb.com/forums/post220840-56.html[/url]

Member Avatar for iamgame
0
759
Member Avatar for besktrap

You might want to take a peekaboo at: [url]http://www.daniweb.com/forums/showpost.php?p=700777&postcount=147[/url]

Member Avatar for vegaseat
0
65
Member Avatar for mruane

This pygame sample code at: [url]http://www.daniweb.com/forums/showpost.php?p=700702&postcount=146[/url] might help you. As long as you give the full path name of your image file, I dont think it makes much of a difference in which directory it is.

Member Avatar for vegaseat
0
73
Member Avatar for christina>you

Interesting indeed! Us humble human beings can readily observe matter and energy, but not the state between the two. Let's postulate that 'dark matter' is this flux state, observed only by its gravitational pull. If you believe this, you sleep better at night. It has the soothing effect of a …

Member Avatar for GrimJack
0
2K
Member Avatar for jlm699

Ouch, you need to study up on Python basics. A lot of errors in your code. Take a look at the corrected code and figure out where you can improve your coding skills ... [code=python]def main(): print ("This is a program that converts a users first name into it's numerical …

Member Avatar for vegaseat
0
119
Member Avatar for vmanes

Well, if he invented the Blackberry, then he isn't quite as primitive as most people think he is. I would be happy with a portion of good humor and health under my tree.

Member Avatar for R0bb0b
0
168
Member Avatar for vmanes

[QUOTE=scru;697472]No, but the ones who want to be perceived as 'creative' use Macs. [I]I use a Mac. That makes me an artist![/I][/QUOTE]I knew you were an artist just from your avatar.

Member Avatar for vmanes
0
155
Member Avatar for SoulMazer

Here would be your program using a dictionary ... [code=python]def test(d): for word in d.keys(): count = 0 while True: print "What does", word, "mean?" ans = raw_input("> ") if ans == d[word]: print "Correct!" break else: print "That is incorrect. Try again." count += 1 # ask 3 times …

Member Avatar for Dunganb
0
2K
Member Avatar for heshan

Thank you for making all of the DaniWeb Python users aware of this great article at: [url]http://wso2.org/library/articles/deploying-python-service-axis2[/url]

Member Avatar for peter_budo
0
107
Member Avatar for leegeorg07
Member Avatar for scru

[QUOTE=Ezzaral;691741]One hour of community service (picking up litter, public land and utilities maintenance and improvements, etc) per spam email sent. 1,000,000 emails sent, mandatory 12 hour work day imposed = 228 years labor. Sounds reasonable to me.[/QUOTE]I go along with that!

Member Avatar for bumsfeld
0
182
Member Avatar for The Dude

while you are at the site take look at the do and don't pics, the comments are a stitch

Member Avatar for omol
0
77
Member Avatar for Stefano Mtangoo

Try app.MainLoop() Also OnInit should return a boolean value, usually True

Member Avatar for vegaseat
0
113
Member Avatar for zandiago
Re: Ufo

If you talk about visitors from outer space, I would say 'no', since distances are simply too far. It would take thousands of years of travel in even the best case. If you talk about loonies, dopers and drunkards seeing something strange, then I would say 'of course!'

Member Avatar for R0bb0b
0
486
Member Avatar for ganil123

This is a very good introduction to the Python language with lots of example code: Learning Python, by Mark Lutz and David Ascher. Published by O'Reilly.

Member Avatar for ganil123
0
101
Member Avatar for tillaart36

Along the line of your problems, I have taken the liberty to code a small example that should help you, see: [url]http://www.daniweb.com/forums/post680387-73.html[/url]

Member Avatar for tillaart36
0
258
Member Avatar for Alex Edwards
Member Avatar for Dave Sinkula

So it's oil again, worth bombing any country into submission, even Russia?

Member Avatar for sneekula
3
300
Member Avatar for alc6379

[QUOTE=serfurj]i didn't know that. are you sure??[/QUOTE] It's called Py2Exe and it is a free download like most of the Python goodies.

Member Avatar for ZZucker
0
523
Member Avatar for db_ozbecool

help("modules") hangs up on bad or modified modules or mixed versions, but lets you know! Works well on virgin installations. I have so many modules installed and screw around with them all the time. So I use help("modules") to flush out the bad stuff.

Member Avatar for woooee
0
163
Member Avatar for Ene Uran

I understand that most of those Nigerian dead friend/relative scams originate from the Netherlands and the perpetrators are mostly Romanian Gypsy gangs.

Member Avatar for Lardmeister
0
161
Member Avatar for lllllIllIlllI

Ene Uran left an example of a screen image grabber in the Python snippets: [url]http://www.daniweb.com/code/snippet707.html[/url] She simply used a small for loop to create a delay long enough to sort things out.

Member Avatar for lllllIllIlllI
0
370
Member Avatar for anderson

Python and some of the standard GUI toolkits themselves do not have a builtin method to display FITS images (they are simply too specialized), but I am sure one of the external scientific modules that handle astronmoy will do just that. I know the PyFITS module will (NASA/Goddard Space Flight …

Member Avatar for anderson
0
277
Member Avatar for dr_hamburger

I have to admit, this is a clever problem. With a little thought it shouldn't stomp anybody. Here are some hints ... [code=python]# assume you have the following text = """\ My name is OUR_HERO, or simply OUR_HERO, somtimes OUR_HERO. You, my dear friend, can call me OUR_HERO. """ keyword_list …

Member Avatar for woooee
0
503
Member Avatar for chillax137

One way to do this ... [code=python]def extract(text, sub1, sub2): """ extract a substring from text between first occurances of substrings sub1 and sub2 """ return text.split(sub1, 1)[-1].split(sub2, 1)[0] # read the data from the file as one string data = """\ #BEGIN 1 1 .1 .2 2 .8 .3 …

Member Avatar for vegaseat
0
158
Member Avatar for Stefano Mtangoo

Which version of the Netbeans IDE did you download for Python coding? Jython allows Python to use the Jave library and feeds into Java byte code. Iron Python, I think, does a similar thing with C# There is also python-like Boo that feeds into the .NET C# compiler. See: [url]http://www.daniweb.com/code/snippet429.html[/url] …

Member Avatar for Stefano Mtangoo
0
207
Member Avatar for Dave Sinkula
Member Avatar for GrimJack
0
610
Member Avatar for tortoiseman
Member Avatar for Ene Uran
Member Avatar for ssharish2005

In addition to Zetlin's nice explanation, tuples are used in passing arguments to and from functions ... [code=pyhon]def myfunction(a, b, c): d = 2 * a e = b + 5 f = c - 1 return d, e, f a = 1 b = 2 c = 3 mytuple …

Member Avatar for sneekula
0
510
Member Avatar for dise652
Member Avatar for Lardmeister
Member Avatar for Jadellll
Member Avatar for lid

Something like ... [code=python]from Tkinter import * fenetre = Tk() portee = IntVar() def effacer(): rb1.deselect() rb2.deselect() rb1 = Radiobutton(fenetre, text="HOT 1/2", font=("Times",-15,'bold'), variable=portee, value=4000) rb1.grid(row=4, column=1, sticky = E) rb2 = Radiobutton(fenetre, text="HOT 3", font=("Times",-15,'bold'), variable=portee, value=3850) rb2.grid(row=4, column=2, sticky = E) # preset rb2 portee.set(3850) bt1 = Button(fenetre, …

Member Avatar for lid
0
13K
Member Avatar for JA5ONS

Maybe you are looking for this ... [code=python]def del_text(): """ delete text in enter1 from index first to index last if index last is omitted delete just one character at index first entry1.delete(first, last=None) """ enter1.delete(0, END) # del all text [/code]

Member Avatar for vegaseat
0
107
Member Avatar for vegaseat

This post by [B]s7plc[/B] was moved from the Starting wxPython (GUI code) thread ... [QUOTE]I've been working with various widgets from the wxPython demo library, and am making pretty good progress. But I just ran into a problem that I am sure has a simple answer, but I just can't …

0
84
Member Avatar for ZZucker

[QUOTE=scru;665318]Does it loop? Does that mean that when it gets past Generation Z it becomes Generation A? :P I have an opinion about the "Baby Boomers", but you said don't be bashful...[/QUOTE]No, it's like a spreadsheet, it goes Generation Z, Generation AA, Generation AB, ... :)

Member Avatar for R0bb0b
0
305
Member Avatar for bimaljr

Be aware that your file extension may not always be .txt, but also could be be .TXT or .tXt or txT or such. To get a full count of all of these mixed case extensions it is best to use module glob ... [code=python]# to also count mixed case file …

Member Avatar for bimaljr
0
8K
Member Avatar for Jadellll

Welcome to the DaniWeb Python forum! Make sure you read some of the posts in "Starting Python" [url]http://www.daniweb.com/forums/thread20774.html[/url] After you read post #4 ( [url]http://www.daniweb.com/forums/post104865-4.html[/url] ), you might recognize that your program can be simplified to ... [code=python]print raw_input("Enter string to be reversed: ")[::-1] raw_input("Press any key to quit") [/code]Sorry, …

Member Avatar for Aia
0
140
Member Avatar for Jadellll

Putting in a temporary test print line might just help you better understand what is going on ... [code=python]def bubble_sort(list1): # make true copy of list1 so there is no feedback list1 = list(list1) for i in xrange(len(list1) - 1, 0, -1): print list1 # a test print for j …

Member Avatar for Jadellll
0
107
Member Avatar for besktrap

Here is an example ... [code=python]# PyGame example of how to change the mouse cursor import pygame as pg bgcolor = 255, 255, 255 # white screen = pg.display.set_mode((600, 300)) pg.display.set_caption('testing a different cursor') screen.fill(bgcolor) # set the mouse cursor # you can replace diamond with arrow, ball, broken_x, tri_left, …

Member Avatar for besktrap
0
195
Member Avatar for mruane

Eliza was the original fake AI program, sounds like Sally will be something similar. Take a look at: [url]http://en.wikipedia.org/wiki/ELIZA[/url] I would favor a program that looks at certain keywords and picks a snappy comeback from a list.

Member Avatar for Alonechild101
0
150

The End.