简体   繁体   English

用记事本++编写的Python程序,TextWrangler中的错误

[英]Python program written in Notepad++, error in TextWrangler

So I wrote a program in python using NotePad++ in Windows, but then when I opened the file in Mac computer using TextWrangler or any text editor in it and after compiling it, there was an error message regarding indentation. 因此,我在Windows中使用NotePad ++在python中编写了一个程序,但是当我在Mac计算机中使用TextWrangler或其中的任何文本编辑器打开该文件并对其进行编译后,出现了关于缩进的错误消息。 How can I easily fix this? 如何轻松解决此问题?

Here is something to do with your file via Notepad++: 这与通过记事本++处理文件有关:

Edit -> Blank Operations -> TAB to Space

If this won't help (and most likely it won't) you will need to check indents manually. 如果这样做没有帮助(很可能没有帮助),则需要手动检查缩进。 I can suggest View -> Show Symbol -> Show Indent Guide for convenience. 为了方便起见,我可以建议View -> Show Symbol -> Show Indent Guide

It is a good and safe style to use only spaces. 仅使用空格是一种很好且安全的样式。 Not to face this problem in your future projects configure Notepad++: Settings -> Tab Settings -> Replace by space . 在将来的项目中不要面对此问题,请配置Notepad ++: Settings -> Tab Settings -> Replace by space You will still be able to use tabs, but they will be changed to defined number of spaces (4 for me). 您仍然可以使用制表符,但是它们将更改为定义的空格数(对我来说是4个)。 Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM