Oct-07-2016, 03:43 AM
emacs is the only editor i know (besides tools like sed) and it has don untabify wrong before so i want to avoid that.
i tried that code:
i tried that code:
Output:lt1/forums /home/forums 6> py3 untab.py bigsqrt.py fixed.py
Traceback (most recent call last):
File "untab.py", line 13, in <module>
main()
File "untab.py", line 7, in main
for line in source:
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xa9 in position 138: ordinal not in range(128)
lt1/forums /home/forums 7> cat untab.py
def main():
from sys import argv
fn = argv[1]
tf = argv[2]
with open(fn, 'r') as source:
with open(tf, 'w') as out:
for line in source:
if line.startswith('\t'):
line = ' '*4 + line[1:]
print(line, end='', file=out)
return
main()
google tells me about the GNU expand command which i found is already in Ubuntu 16.04.1 LTS :) it seems to work so i will attach the fixed file. the attach system here does not like .pike so an untabify of that is not attached.
Attached Files
bigsqrt.py (Size: 4.75 KB / Downloads: 4)
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.