1.唐’t mix ‘tab’ 和 ‘space’ indentations in 纳米 editor:
这是我反射引起的常见错误。有时候我’m lost in writing the program 和 I mix the Tab 和 空间 keys for indentation. I change in 纳米 the 标签 character 空间s to 4 和 everything works without syntax mistakes if I use only the 标签 key for indentation.
Step 1: Go to your home directory 和 type the command: sudo 纳米 /etc/nanorc
Step 2:导航到配置文件,直到带有#set 标签size 8的行
Step 3:删除#并将4代替8
Step 4: – Ctrl + O –保存文件,然后– Ctrl + X – to close the file
2. change the 纳米 editor with an IDE 和 use git:
这是一个主意:在Windows PC上编写Python脚本,提交到git,然后通过SSH连接以克隆git软件包。这样,我将减少语法错误。同时,例如,如果我仅提供一行新代码,则将花费更多时间来检查其是否有效。我没有’t测试此方法。如果有人在Raspberry Pi上使用此方法,请在此方法的优缺点旁发表评论。