Python Forum
bigsqrt - Python vs Pike
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
bigsqrt - Python vs Pike
#10
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:
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

.py   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.


Messages In This Thread
bigsqrt - Python vs Pike - by Skaperen - Oct-04-2016, 06:23 AM
RE: bigsqrt - Python vs Pike - by wavic - Oct-04-2016, 09:10 AM
RE: bigsqrt - Python vs Pike - by nilamo - Oct-04-2016, 06:21 PM
RE: bigsqrt - Python vs Pike - by micseydel - Oct-04-2016, 07:56 PM
RE: bigsqrt - Python vs Pike - by Skaperen - Oct-05-2016, 04:44 AM
RE: bigsqrt - Python vs Pike - by snippsat - Oct-05-2016, 09:42 AM
RE: bigsqrt - Python vs Pike - by nilamo - Oct-05-2016, 02:30 PM
RE: bigsqrt - Python vs Pike - by Skaperen - Oct-06-2016, 12:24 AM
RE: bigsqrt - Python vs Pike - by nilamo - Oct-06-2016, 02:52 PM
RE: bigsqrt - Python vs Pike - by Skaperen - Oct-07-2016, 03:43 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020