Ene Uran 638 Posting Virtuoso

If it's like the like() function in VB, then you can do it with module re, which does have wildcard and characterlist patterns.

Ene Uran 638 Posting Virtuoso

Every three days? Consider yourself lucky and let's leave it at that.

I agree, my cplusplus eats two rats a day, and I had to move to the inner city so it wouldn't starve!

Ene Uran 638 Posting Virtuoso

Oops!

Ene Uran 638 Posting Virtuoso

Not if Iran wipes us off the map first :)

I read that Hillary's remark was in regard to Iran attacking Israel. One way to get Jewish votes and sound tough at the same time. Poor Obama, he looks like a naive Sunday school teacher.

To wipe the USA off the map would take well over 10,000 nuclear bombs of the primitive type Iran would produce.

Ene Uran 638 Posting Virtuoso

Stalin's left arm was ... ?

Ene Uran 638 Posting Virtuoso

Just finished a pork chop and two eggs sunny side up. This old fashioned south side diner has great java.

I am not supposed to eat pork, but have done it a few times and lightning has not struck me!

Ene Uran 638 Posting Virtuoso

Tomatoes contain more vitamins relative to their mass than any other vegetable or fruit.

VegaSeat, like you new arty avatar!

Ene Uran 638 Posting Virtuoso

It is not what happens to you but how you respond to what happens to you that determines how you feel.

I drink to that!

Never answer an anonymous letter.

Ene Uran 638 Posting Virtuoso

I don't see any new avatars. Just a couple of old ones that have been adopted.

Ene Uran 638 Posting Virtuoso

In a nutshell:

def add(a, b):
    return a + b

var = 2
str = "var = add(2, 3)"
# execute the code snippet inside the str string variable
exec(str)
print var  # --> 5
Ene Uran 638 Posting Virtuoso

In Finland they banned Donald Duck comics because he doesn't wear pants.

Ene Uran 638 Posting Virtuoso

I love deadlines. I especially like the whooshing sound they make as they go flying by.

Ene Uran 638 Posting Virtuoso

80 percent of car trips in the United States are less than one mile in distance.

Ene Uran 638 Posting Virtuoso

I guess whether or not you like a commercial is still a matter of taste. I think commercials make watching TV at least a little interesting.

Ene Uran 638 Posting Virtuoso

Why do psychics have to ask your name?

Ene Uran 638 Posting Virtuoso

When no one trusts, does it matter that everyone lies?

Ene Uran 638 Posting Virtuoso

Guess where I am pierced?

Ene Uran 638 Posting Virtuoso

Why is abbreviation such a long word?

Ene Uran 638 Posting Virtuoso

Your exploration could aid other folks. Just remember that Python style recommends to have class names begin with upper case and function/method names to begin with a lower case letter.

Ene Uran 638 Posting Virtuoso

You can run the command window from python and obtain the results and error messages:

# run DOS cmd.exe from Python code
# works on XP, but may not work on Windows Vista

import subprocess

cmd = "cmd.exe"
command = "dir c:"

p = subprocess.Popen(cmd,
    shell=True,
    #bufsize=1,
    stdin=subprocess.PIPE,
    stdout=subprocess.PIPE,
    stderr=subprocess.PIPE)

# the \n is important to flush buffer
p.stdin.write("%s\n" % command)

p.stdin.close()
# give it enough time to respond
p.wait()

# optional check (0 = success)
print p.returncode

# read the result to a string
result = p.stdout.read()
print result

# optionally read any error message returned
error = p.stderr.read()
print "error =", error
Ene Uran 638 Posting Virtuoso

Two possibilities exist: Either we are alone in the Universe or we are not. Both are equally terrifying.

Ene Uran 638 Posting Virtuoso

Edgar Allan Poe was kicked out of West Point.

Ene Uran 638 Posting Virtuoso

Women need a reason to have sex. Men just need a place.
quote by Billy Crystal

Ene Uran 638 Posting Virtuoso

A rabbi and a minister were at the neighbourhood picnic. As they rode in one of the boats on the lake, the rabbi stood up, stepped out of the boat, and walked over the water to the nearby stretch of land.

Astonished, the minister decided to see if he could duplicate this miraculous feat. He stepped out of the boat and sank, but managed to swim ashore.

As he stood there drying himself off, the rabbi walked over and said, "Next time ask me first, and I will show you where the rocks are!"

~s.o.s~ commented: Heh. +21
Ene Uran 638 Posting Virtuoso

It is better to fail in originality than to succeed in imitation.

Ene Uran 638 Posting Virtuoso

Now you know why so many folks watch TV because of the commercials rather than the lousy content of the program.

Ene Uran 638 Posting Virtuoso

Nearly 35% of self-professed Christians believe that it was Jesus, not Moses, who parted the Red Sea. Only 1% of Jews make the same mistake.

Ene Uran 638 Posting Virtuoso

Please use code tags around your Python code to preserve the proper indentations. Check the message in the background of the Quick Reply message box for the code tags.

Ene Uran 638 Posting Virtuoso

Do you just want to know if they are equal? If that is the case, you can simply use:

# compare two files and check if they are equal
# files can be binary or text based

import filecmp

# pick two files you want to compare ...
file1 = "Boing1.wav"
file2 = "Boing2.wav"
if filecmp.cmp(file1, file2):
    print "Files %s and %s are identical" % (file1, file2)
else:
    print "Files %s and %s differ!" % (file1, file2)
Ene Uran 638 Posting Virtuoso

I think vegaseat had this posted some time ago, read the comments for instructions:

# Py2Exe version 0.6.3 setup file for console programs.
#
# If this is a windows GUI application replace the last line with
# windows = [{"script": 'myFile.py'}] )
#
# Enter the file name of your own .py code file in the last line,
# lets say it's test1.py
# so the last line should be: console = [{"script": 'test1.py'}] )
# then save this program as   p2e_test1.py  to the same directory 
# where your code file is located.
#
# Now run p2e_test1.py ...
#
# Two subfolders will be created, called  build and  dist.
# The dist folder contains your .exe file, MSVCR71.dll and 
# w9xpopen.exe (needed for os.popen() only)
# Your .exe file contains your byte code, all needed modules and
# the Python interpreter.
# The MSVCR71.dll can be distributed, but is often already in the 
# system32 folder.
# The build folder can be deleted.

from distutils.core import setup
import py2exe
import sys

# no arguments
if len(sys.argv) == 1:
    sys.argv.append("py2exe")

# creates a standalone .exe file, no zip files
setup( options = {"py2exe": {"compressed": 1, "optimize": 2, "ascii": 1, "bundle_files": 1}},
       zipfile = None,
       # replace myFile.py with your own code filename here ...
       console = [{"script": 'myFile.py'}] )
Ene Uran 638 Posting Virtuoso

Like the Club80s site! Thanks Dude!

Ene Uran 638 Posting Virtuoso

Only in Japan would folks be polite enough not to kill this dude.

Ene Uran 638 Posting Virtuoso

US $100 bills of series 2003A and later will not burn! (I have not tried this yet!)

Ene Uran 638 Posting Virtuoso

Bill Gates made his fortune with Microsoft, but is investing it elsewhere through his investment vehicle 'Cascade Investment', like Mexican brewer Fomento Económico Mexicano.

Ene Uran 638 Posting Virtuoso

Geek Girls Kick Ascii!

Ene Uran 638 Posting Virtuoso

Coffee, Chocolate, Men
are best when rich

Ene Uran 638 Posting Virtuoso

When women are depressed they either eat or go shopping. Men just invade another country.
-- Elayne Boosler

Ene Uran 638 Posting Virtuoso

Somewhat repugnant! Do they teach that sort of skill in public school?

Ene Uran 638 Posting Virtuoso

Wow Zoe, very nice write about John McCain.

Watching McCain on TV, is this man lacking from coherence? He seems to mix up his Iraq and Iran items and needs to be corrected by invided people around him.

Aren't you glad we have Senator Lieberman around to whisper in his ear?

Ene Uran 638 Posting Virtuoso

This year, thanks to George Bush, after we file our taxes we all get back around $500, starting May, so we can stimulate the Walmart economy.

Ene Uran 638 Posting Virtuoso

The General:
"All our extra scacrifice in stabilizing Iraq has worked! However, if we leave, it will all fall apart."

Ene Uran 638 Posting Virtuoso

The happiest people don't necessarily have the best of everything. They just make the best of everything.
(Jewish proverb)

Ene Uran 638 Posting Virtuoso

The Pope contacted all of his Cardinals with the urgent message, "Get to Rome as quickly as you can!"

Once there he assembled them and said, "I'm afraid I've got some good news and some bad news. First the good news; God spoke to me on the phone and told me that the world was going to end this Friday, and we should prepare our congregations."

"Excuse me, Your Holiness," queried a Cardinal, "If that is the good news, what could the bad news possibly be?

"He was calling from Mecca!"

Ene Uran 638 Posting Virtuoso

If electricity comes from electrons, does morality come from morons?

bloody_ninja commented: this is win +1
Ene Uran 638 Posting Virtuoso

Please use code tags to mainain proper Python indentations!

def my_f(modelfilename):
    modelfile = open(modelfilename)
    modelline_list = modelfile.readlines()
    modelfile.close()

    itemY = ["lol", "young", "HoLa", "...", "Yum!",
        ":o)", "blokes", "!!!", "hello"]
    itemO = ["old", "yes", "Mom", "serious", "blog"]

    for line in modelline_list:
        for itemy in itemY:
            if itemy in line:
                print "+1 young"
                # not sure if this is what you want?
                return line  
            else:
                print "-1 old"
Ene Uran 638 Posting Virtuoso

Read line 8 and 9, you got to have the properly named icon image file for this to work.

Ene Uran 638 Posting Virtuoso

Give module subprocess a try, it's a bit more advanced:

import subprocess

# execute the code and pipe the result to a string
test = "ping xxx.xxx.xxx.xxx"
process = subprocess.Popen(test, shell=True, stdout=subprocess.PIPE)
# give it time to respond
process.wait()
# optional check (0 --> success)
print process.returncode  
# read the result to a string
result_str = process.stdout.read()
# test it ...
print result_str
Ene Uran 638 Posting Virtuoso

You can use a similar concept as shown in the entry case, using a name_list.

Ene Uran 638 Posting Virtuoso

Give this a try:

import random

data = ["apple", "orange", "melon", "pear"]
# this picks one item from the list above
print random.choice(data)
Ene Uran 638 Posting Virtuoso

With Python you can use the slicing operator to help out:

t1 = '1230'  # --> 12:30
t2 = '100'   # --> 1:00

# slicing operator seq[begin : end : step]
# step is optional
# defaults are index begin=0, index end=len(seq)-1, step=1
# -begin or -end --> count from the end backwards
# step = -1 reverses sequence
hr1 = t1[:-2]
mn1 = t1[-2:]
print hr1, mn1  # test --> 12 30


hr2 = t2[:-2]
mn2 = t2[-2:]
print hr2, mn2  # test -->  1 00