Re: A simple question string.replace
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: A simple question string.replace

From: I V <wrongbad@gmail.com>
Date: Tue Jan 31 2006 - 06:01:23 CET

Haibao Tang wrote:
> Is it possible to substitue all '1.1' to some value else without using
> re.

You could try:

import sys

values = sys.stdin.readline().split()
while values:
    results = []
    for value in values:
        if value != '1.1':
            results.append(value)
        else:
            results.append('something else')

    print '\t'.join(results)
    values = sys.stdin.readline().split()
Received on Tue Feb 7 20:19:01 2006