codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
#no const keyword in Python, so: def constant(f): def fset(self, value): raise SyntaxError def fget(self): return f() return property(fget, fset) class _Const(object): @constant def COMMA(): return ',' @constant def EMPTYSTR(): return '' CONST = _Const() line='1,2,3\n4,5,6\n7,8,9' delim = '\n' clean = line.replace(CONST.COMMA,CONST.EMPTYSTR) words = clean.split(delim); for nums in words: print nums
Private
[
?
]
Run code
Submit