Is there an easy way to control indents in Python
Chris Angelico
rosuav at gmail.com
Tue Oct 14 22:18:46 EDT 2014
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.
ChrisA
More information about the Python-list
mailing list