Search Results - JustLinux Forums


Search:

Type: Posts; User: Strike

Search: Search took 1.20 seconds.

  1. Replies
    278
    Views
    668,660

    You can do whole thing in one line if you want. ...

    You can do whole thing in one line if you want.



    file('/home/mrben/output.txt','w').write(__import__('re').sub('\t',' ',(file('/home/mrben/input.txt','r').read())))


    Notes: use file, not...
  2. Replies
    278
    Views
    668,660

    [/b] Yeah, but so are hex and int. But they are...

    [/b]
    Yeah, but so are hex and int. But they are all builtins, so it's not like he's using a library or something.

    Also, mrBen, yours wouldn't take an ipv6 address and do it because those use ':'...
  3. Replies
    278
    Views
    668,660

    Is this a joke?

    Is this a joke?
  4. Replies
    278
    Views
    668,660

    tecknophreak: you underconstrained it ;) ...

    tecknophreak: you underconstrained it ;)

    mrBen, that works, here's a properly indented version:




    >>> x = 0; y = 0
    >>> while y < 10000:
    ... y = 0
  5. Replies
    278
    Views
    668,660

    How about no variables, no additions, and no...

    How about no variables, no additions, and no while loop?



    >>> print [x**2 for x in range(int(math.sqrt(10000)))]
    [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144,
    169, 196, 225, 256, 289,...
  6. Replies
    278
    Views
    668,660

    The python rot13 can be made way shorter: ...

    The python rot13 can be made way shorter:



    def rot13(s):
    return s.encode('rot13')


    :)
Results 1 to 6 of 6