Search:
Type: Posts; User: Strike
Search:
Search took 1.20 seconds.
-
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...
-
[/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 ':'...
-
-
tecknophreak: you underconstrained it ;)
mrBen, that works, here's a properly indented version:
>>> x = 0; y = 0
>>> while y < 10000:
... y = 0
-
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,...
-
The python rot13 can be made way shorter:
def rot13(s):
return s.encode('rot13')
:)
|
|