Script that converts between indentation and curly braces in Python code

Joel Goldstick joel.goldstick at gmail.com
Wed Jul 31 14:37:55 CEST 2013


On Tue, Jul 30, 2013 at 11:45 PM, Musical Notation
<musicdenotation at gmail.com> wrote:
> Is there any script that converts indentation in Python code to curly braces? The indentation is sometime lost when I copy my code to an application or a website.

I guess you could google that.

What do you mean that indentation is 'sometimes' lost when copying.  I
think you should walk down that path to understand why you are losing
your indentation.  It could be you are using tabs instead of spaces
for indentation.  It could also be that you are inserting your code
directly into HTML which of course will eat the extra whitespace.
That problem can be solved with <pre> tags, or maybe even <code> (but
I am not sure about that)

If you are copying code to a website like stack exchange you need to
precede each line of code with  (2 I think!) spaces.  They use
markdown.

If you wanted to add in curly braces, I am guesses the only purpose
for this would be that you would convert them back to proper
indentation in the copied to environment.  So then you have to figure
out a way to do that.



> --
> http://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com



More information about the Python-list mailing list