Is there an easy way to control indents in Python

Zachary Ware zachary.ware+pylist at gmail.com
Tue Oct 14 22:35:12 EDT 2014


On Tue, Oct 14, 2014 at 9:18 PM, Chris Angelico <rosuav at gmail.com> wrote:
> On Wed, Oct 15, 2014 at 1:13 PM, ryguy7272 <ryanshuell at gmail.com> wrote:
>> I'm just learning Python.  It seems like indents are EXTREMELY important.  I guess, since there are no brackets, everything is controlled by indents.  Well, I'm reading a couple books on Python now, and in almost all of the examples they don't have proper indents, so when I copy/paste the code (from the PDF to the IDE) the indents are totally screwed up.  I'm thinking that there should be some control, or setting, for this.  I hope.  :)
>>
>
> That probably depends on the person who made the PDF. You may simply
> have to copy and paste one line at a time; if you're using an editor
> that understands Python syntax, it'll do some of your indenting for
> you, and you'll just have to manually mark the unindents.
> Alternatively, just paste it all in without indentation, then go
> through and select blocks of code and hit Tab; in many editors,
> that'll indent the selected code by one level. But ultimately, the
> fault is almost certainly with the PDF.

Agreed, although I'd say the PDF viewer could also be at fault.
Earlier today I tried to copy just a paragraph of mostly plain text
from the Firefox built-in PDF viewer, but when pasting it elsewhere,
it was pasted one character per line.  Opening it in the Windows 8.1
default PDF viewer (of all things...), copying and pasting worked like
a charm.

-- 
Zach



More information about the Python-list mailing list