[Tutor] Notepad++ question

Brad Hudson brad.hudson at gmail.com
Thu Jun 7 14:09:51 CEST 2012


I don't use notepad or notepad++, so I don't know the settings. However, if
you're familiar with vi/vim, you can download the CLI from www.vim.org for
almost any flavor OS and it works quite well on Windows.

BTW: you can customize your settings to use spaces instead of tabs, among
others, which is usually a source of these types of indentation errors.

On Wed, Jun 6, 2012 at 11:29 PM, Alexander Quest <redacted@example.com>wrote:

> Hey all; my question is regarding editing Python code in Notepad++. When I
> run this piece of code in Notepad++:
>
> def fix_start(s):
>   var1 = s[0]
>     var2 = "*"
>   var3 = s.replace(var1, var2)
>
>   return var3
>
>
> I get an indentation error, which reads:
>
>
>   File "C:\google-python-exercises\google-python-exercises\basic>string1.py
> line 56
>     var2 = "*"
>     ^
> IndentationError: unexpected indent
>
>
> The thing is that in Notepad++, that code does not appear with an
> indentation where var2 is. It appears like this:
>
> def fix_start(s):
>   var1 = s[0]
>   var2 = "*"
>   var3 = s.replace(var1, var2)
>
>   return var3
>
> but when I copy and paste it, it pastes with an indentation where var2 is,
> which is what I think is causing the error. The code runs fine if I just
> use IDLE. I am doing Google's python exercises, and they recommended I edit
> the settings on Notepad++ to indent 2 spaces upon a tab, this being the
> convention at Google. Does anyone know what the deal is here? Also, I am
> wondering why use Notepad++ or other such programs when IDLE seems to be
> fine for writing code. Thanks.
>
> -Alex
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120607/2aee736e/attachment.html>


More information about the Tutor mailing list
l>