407 Posted Topics
Re: 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 … | |
Re: 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] | |
Re: 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. | |
Re: If you want to clear the whole canvas instance of all items on it, use: canvas.delete('all') | |
Re: 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 … | |
Re: 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 --> … | |
Re: 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 … | |
Re: I going out with friends later to get a triple cheese and pinapple pizza. There will be plenty of Labatt Blue beer. | |
Re: 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. . | |
![]() | Re: [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! |
Re: 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. | |
| |
Re: 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] | |
Re: 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. | |
Re: [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. | |
Re: [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. | |
Re: Please wrap your code in code tags. | |
| |
Re: [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, … | |
![]() | Re: [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 … |
Re: [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, … | |
Re: [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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: Some college profs use the old graphics module to keep their students honest. | |
Re: I think you have to use either END or 'end' and 1.0 for line.column. | |
Re: I think "GeorgeWalkerBush" would be a good password. Nobody would type that without getting pissed. :) | |
Re: 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. | |
Re: [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! | |
What is the easiest or most elegant way to let the user input a list in a console program? | |
Re: I thought cairo was associated with the pyGTK/GTK GUI toolkit. | |
Re: Yahoo is a little like Microsoft, always trailing behind in technology. Look what others have and copy or buy it. | |
Re: [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, … | |
Re: 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. | |
Re: 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 … | |
Re: 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. | |
Re: 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 … | |
Re: 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] | |
Re: Save money so I can buy lots of Google stock later on. | |
Re: "Self Esteem is feeling good about yourself, regardless of the facts." -- sign at a fitness center | |
Re: Babies come from the cabbage patch of course. Anything else are just old wife tales! | |
Re: 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. … | |
Re: [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 … | |
Re: I always heard Sweden is known for very slow people. They think snail hunting is an exciting sport. |
The End.