407 Posted Topics

Member Avatar for PC_Nerd

I found this word wrap function somewhere: [code=python]def wrap(text, width): """ A word-wrap function that preserves existing line breaks and most spaces in the text. Expects that existing line breaks are linux style newlines (\n). """ def func(line, word): nextword = word.split("\n", 1)[0] n = len(line) - line.rfind('\n') - 1 …

Member Avatar for PC_Nerd
0
6K
Member Avatar for Raulito

Here is one example: [code=python]# print 0 to 127 in a table of 16 columna n = 1 for k in range(0, 128): if n % 17: print "%4d" % k, else: print n += 1 [/code]

Member Avatar for Ryanvh
0
154
Member Avatar for sneekula

In Disney World they have a people mover system on rails, where each four passenger car is propelled by computer controlled electro magnets in the rail bed. Sorry I am not an engineer, so I can't explain this too well.

Member Avatar for GrimJack
0
677
Member Avatar for nish88

If you want to clear the whole canvas instance of all items on it, use: canvas.delete('all')

Member Avatar for vegaseat
0
10K
Member Avatar for sneekula

I keep dreaming about moving into this huge old house. I really like the house, it has a lot of charm, but it's not in good repair. So my folks and I go around trying to fix things. We keep finding more and more rooms. Some with holes in the …

Member Avatar for GrimJack
0
504
Member Avatar for LanierWexford

Really not that much different than C: [code=python]# while statement to add spaces to string until lenght == 70 def right_just(s): while len(s) < 70: s = " " + s return s s = '1234567890' # acts as ruler print s * 7 print right_just(s) """ my result --> …

Member Avatar for LanierWexford
0
118
Member Avatar for GreyInTheLaw

Jeff, thanks for the idea. I was just working on a project that needed a secure date input. This what I came up with: [code=python]# a more secure way to enter a date import datetime as dt def enter_date(): """ asks to enter year, month and day and returns date …

Member Avatar for ZZucker
0
174
Member Avatar for TheNNS

I going out with friends later to get a triple cheese and pinapple pizza. There will be plenty of Labatt Blue beer.

Member Avatar for Lardmeister
0
919
Member Avatar for The Dude

I am a ZZ Top fan! "Ucker" is a mechanical device used in Norway to harvest hay from almost vertical slopes, mostly red clover, wild timothy, sweetgrass, and purple alsike. You feed this hay to cows and the milk they produce tastes exquisite. .

Member Avatar for maui_mallard
0
245
Member Avatar for thunderstorm98

[QUOTE=jwenting;471356]With still a 5-10% failure rate (in which I describe failure as your vision after the procedure being worse than it was before) I call it definitely NOT safe.[/QUOTE]If something goes wrong, sue them for big bucks!

Member Avatar for jbennet
0
121
Member Avatar for ! !

Soy products have a tendency to enlarge your breasts because of estrogen like compounds. Nice for the girls, but not so good for the boys. I couldn't live without chocolates.

Member Avatar for jbennet
0
438
Member Avatar for maui_mallard
Member Avatar for Lardmeister
0
321
Member Avatar for implor

To make this more general: [code=python]def remove_uni(s): """remove the leading unicode designator from a string""" if s.startswith("u'"): s2 = s.replace("u'", "'", 1) elif s.startswith('u"'): s2 = s.replace('u"', '"', 1) return s2 s = 'u"you're my favorite string"' print remove_uni(s) # "you're my favorite string" [/code]

Member Avatar for jrcagle
0
17K
Member Avatar for zandiago

A new search warrant for electronic devices? We need to really educate the members of our judicial system then, or let a computer issue the warrant after answering three simple random questions. IMHO: If you want privacy, hide in a cave.

Member Avatar for jbennet
0
640
Member Avatar for The Dude

[QUOTE=The Dude;541754]I read the officer was fired for what happend....[/QUOTE]Good! He needs to send his application to the Abu Ghraib prison in Iraq! They are hiring this kind of trash.

Member Avatar for ZZucker
0
129
Member Avatar for zandiago

[QUOTE=Narue;536238]Life isn't fair. Personally, I'm wondering why you chose CEOs to bash for making obscene amounts of money and not professional athletes or actors.[/QUOTE]You are so correct! I guess entertainment is more important than anything else.

Member Avatar for briansmall
0
396
Member Avatar for nish88
Member Avatar for Lardmeister
Member Avatar for Lardmeister
0
730
Member Avatar for The Dude

[QUOTE=~s.o.s~;522624]> I consider being called "a despised cocky kid" and insult! Watch your poor manners! You started it all by dragging my country name into this discussion without any reason and turning a friendly discussion into what it is now. Keep your sarcasm/pointed remarks to yourself and if you can't, …

Member Avatar for twomers
4
518
Member Avatar for iamthwee

[QUOTE=twomers;527614]I have a reputation of dumping people before Val's day. So much so that my friends have a bet that I'll get a girlfriend before the 14th and dump her before the 14th. Not a serious one mind. It's the most economic solution. Dinner. 'Present'. I might as well just …

Member Avatar for joshSCH
0
395
Member Avatar for zandiago

[QUOTE=zandiago;535872]I think we ought to get back to the topic at hand![/QUOTE]What was the topic? IMHO the press is very biased, emphasizes some things and misses the boat on others. There are a lot more important things going on then the war on terror. Things like the war on povery, …

Member Avatar for ZZucker
1
264
Member Avatar for The Dude

[QUOTE=uniquestar;512235]Being from britain, I'm not really sure what a pretzel is, although a free anything is always good![/QUOTE]I think they originally came from Poland and are biscuits made from a slender roll of dough dipped in lye and heavily sprinkled with salt then baked in the form of a loose …

Member Avatar for Lardmeister
0
121
Member Avatar for Serunson

Wow, now we can call you 2k-Serunson. You look good with 2 stars. A few months more and you will sail right by young jbennet.

Member Avatar for Mashka
0
198
Member Avatar for maui_mallard

If I had all the money in the world, I would have to hire a huge private army (something like Blackwater) right away to protect it. Too many headaches! I would be happier without it. You couldn't even give it away quickly, it would create one giant riot. I guess …

Member Avatar for Anonymous86
0
150
Member Avatar for maui_mallard

A cup of cold coffee, a half empty bag of Milano Double Chocolate cookies, and a Firemen calendar my sister gave me. Wow, those guys sure wear skimpy uniforms.

Member Avatar for bumsfeld
0
113
Member Avatar for enigmaenigma

Here is a mild hint: [code=python]import re s = "Lotus 123 is an older spread-sheet, still in use though!" # sub all characters with empty "" that are not letters p = re.compile("[^a-z A-Z]") s2 = p.sub("", s) print s2 # Lotus is an older spreadsheet still in use though …

Member Avatar for enigmaenigma
0
84
Member Avatar for gusbear

Some college profs use the old graphics module to keep their students honest.

Member Avatar for jrcagle
0
115
Member Avatar for Haze
Member Avatar for ZZucker
0
185
Member Avatar for Jicky

I think "GeorgeWalkerBush" would be a good password. Nobody would type that without getting pissed. :)

Member Avatar for technogeek_42
0
387
Member Avatar for Lardmeister

I like my boyfriends clean shaven and cleanly dressed. If they have wit and a friendly smile, I will take them even unshaven. If they like to dance, and are good at it, I can overlook a lot of cosmetic flaws.

Member Avatar for ~s.o.s~
2
307
Member Avatar for Ene Uran

[QUOTE=sneekula;523591]It's on a Sunday, and my religion does not allow me partake in such spectacles and the associated sinful behaviour.[/QUOTE]Good Lord, I feel sorry for you! The Patriots will stomp the Giants and make Dwarfs out of them!

Member Avatar for maravich12
0
309
Member Avatar for Ancient Dragon
Member Avatar for ZZucker

What is the easiest or most elegant way to let the user input a list in a console program?

Member Avatar for vegaseat
0
173
Member Avatar for raghuramos
Member Avatar for zandiago
Member Avatar for werks

Yahoo is a little like Microsoft, always trailing behind in technology. Look what others have and copy or buy it.

Member Avatar for joshSCH
0
231
Member Avatar for Agni

[QUOTE=Narue;522602]>what do u guys think?? How about this? If you exceed 500 posts (Coffee House doesn't count), 50 solved threads, and maintain at least 4 green rep blocks, I'll give you one "get out of jail free" card. That means if you somehow accumulate enough infractions to be automatically banned, …

Member Avatar for Ezzaral
0
112
Member Avatar for HazardTW

No other than the famous Stephen Hawking said: "Intelligence is the ability to adapt to change." That includes the change from XP to Vista. I think Vista looks so cool! It works for many things fairly well.

Member Avatar for HazardTW
0
648
Member Avatar for LanierWexford

As luck would have it, I am learning Python in my bio course and came up with this. Hope it helps. Python is a very elegant and higher level language, so you don't want to exactly think like you do with C++. First I had to create a test data …

Member Avatar for Ene Uran
0
108
Member Avatar for jforell

jforrel, nice job. Please look at [url]http://www.daniweb.com/forums/announcement114-3.html[/url] to learn how to add code tags around your code.

Member Avatar for ZZucker
0
102
Member Avatar for fonz87

Here are some hints readily plugged from the Python manual: [code=python]# let the user enter numbers into a list input_list = [19, 37, 23, 67, 45, 54] max_element = max(input_list) print max_element # --> 67 # user enters the string with raw_input() input_string = "hello everybody" upper_string = input_string.upper() print …

Member Avatar for ZZucker
0
82
Member Avatar for Impact4ever

Here is a function that works both on Windows and Linux: [code=python]def clear_screen(): """ clear the screen in the command shell works on windows (nt, xp, Vista) or linux """ import os os.system(['clear','cls'][os.name == 'nt']) [/code]

Member Avatar for Impact4ever
0
104
Member Avatar for Dave Sinkula
Member Avatar for The Dude
Member Avatar for Jicky

"Self Esteem is feeling good about yourself, regardless of the facts." -- sign at a fitness center

Member Avatar for vegaseat
0
270
Member Avatar for sarabhjeet
Member Avatar for lasher511

Babies come from the cabbage patch of course. Anything else are just old wife tales!

Member Avatar for sneekula
0
276
Member Avatar for ryan_vietnow

The professor recommended that we use DrPython in class. The free DrPython IDE lets you download a code completion plug in, set the default folder and many other things. Simply extract the zip file into your Python folder. You can download it from: (Windows and Linux) [url]http://sourceforge.net/projects/drpython/[/url] I downloaded eg. …

Member Avatar for sneekula
0
152
Member Avatar for uniquestar

[QUOTE=jwenting;512082]still? My mother suffered that, got caned when she used her left hand and eventually had it tied behind her back for days to force her to use her right hand for everything. My teachers tried to make me change from writing left handed as well, but not forcibly (they …

Member Avatar for scru
0
153
Member Avatar for invisal

I always heard Sweden is known for very slow people. They think snail hunting is an exciting sport.

Member Avatar for Estella
0
289

The End.