1.忘记在 if , elif , else , for , while , class ,def 声明末尾添加 “:”
2.使用 = 而不是 ==,= 是赋值操作符而 == 是等于比较操作
3.尝试使用Python关键字作为变量名
Python3的关键字有:and, as, assert, break, class, continue, def, del, elif, else, except, False, finally, for, from, global, if, import, in, is, lambda, None, nonlocal, not, or, pass, raise, return, True, try, while, with, yield等
4.++ 或者 -- 自增自减操作符
例如 C++ , Java , PHP 等其他的语言,也许你会想要尝试使用 ++ 或者 -- 自增自减一个变量。在Python中是没有这样的操作符的
此错误会经常出现,属于通用错误,可查看其他报错信息进行辅助排查

SyntaxError :invalid syntax Python常见错误的更多相关文章

  1. python 3.4.0 简单的print 'hello world',出错--SyntaxError: invalid syntax

    问题描写叙述: win7下安装的python 3.4.0版本号, 在命令行里写入简单的输出语句: print 'hello world' 然后enter,结果返回结果为: SyntaxError: i ...

  2. python import错误 SyntaxError: invalid syntax

    导入一个叫service-listener.py的文件是一直遇到错误: SyntaxError: invalid syntax 单独运行service-listener这个文件时,没有问题,只是不能被 ...

  3. Python 3.6print 出现 SyntaxError: invalid syntax

    开始使用sublime学习python,编写代码如图 Ctrl+B运行以后,报错   SyntaxError: invalid syntax 百度查询以后,大部分的回答都是说,python在3.0以后 ...

  4. Python print "hello world" SyntaxError: invalid syntax

    刚安装Python,在IDLE中输入print “Hello World”,谁知却发生错误: >>> print "Hello World"SyntaxError ...

  5. Centos中Python升级为3.X时yum出现except OSError, e: ^ SyntaxError: invalid syntax问题 No module named 'pip._internal.main

    CentOS 7升级Python到3.7.2后,需要在/usr/bin/python创建了一个指向Python 3的软连接,然后将/usr/bin/yum的顶部的: !/usr/bin/python ...

  6. python d:\test.py File "<stdin>", line 1 python d:\test.py ^ SyntaxError: invalid syntax

    pyhton出错: python d:\test.py File "<stdin>", line 1 python d:\test.py ^SyntaxError: i ...

  7. python json.dumps(output) ^ SyntaxError: invalid syntax

    问题 下面代码在有些机器上执行正常,有些机器上执行报错: import json output={} print json.dumps(output) python代码报错: line 277 pri ...

  8. python3下tomorow模块报语法错误def async(n, base_type, timeout=None): ^ SyntaxError: invalid syntax

    python3 pip 安装tomorrow模块,调用时候会报错:def async(n, base_type, timeout=None): ^ SyntaxError: invalid synta ...

  9. 使用python pip安装工具组件包:出现 requests File “<stdin>",line 1 pip install xxx ^ SyntaxError:invalid syntax

    最近想要试试python ,软件安装完成了,但是,import 组件包时,出了问题,一直不得解:安装pycharm 工具感觉麻烦,不想安装那些,只想单纯使用python . 问题复现: 1.Windo ...

随机推荐

  1. tree ignore & bash & cmd

    tree ignore & bash & cmd tree ignore https://unix.stackexchange.com/a/47806 https://zaiste.n ...

  2. 微软 AI 公开课

    微软 AI 公开课 https://github.com/microsoft/ai-edu https://school.azure.cn/ https://docs.microsoft.com/le ...

  3. 如何取消 Google Cloud Platform 试用 & 关闭 GCP 帐号 & 删除信用卡 & 取消订阅

    如何取消 Google Cloud Platform 试用 & 关闭 GCP 帐号 & 删除信用卡 & 取消订阅 关闭您的 Google Cloud Platform 帐号 s ...

  4. PPT & order & animation

    PPT & order & animation powerpoint order of appearance https://support.office.com/en-us/arti ...

  5. wxPython 创建基本窗口

    $ pip install wxPython import wx class MyFrame(wx.Frame): def __init__(self, parent, title): super(M ...

  6. Linux/UNIX编程如何保证文件落盘

    本文转载自Linux/UNIX编程如何保证文件落盘 导语 我们编写程序write数据到文件中时,其实数据不会立马写入磁盘,而是会经过层层缓存.每层缓存都有自己的刷新时机,每层缓存都刷新后才会写入磁盘. ...

  7. Mac上的Redis安装和使用

    redis简介 REmote DIctionary Server(Redis) 是一个由 Salvatore Sanfilippo 写的 key-value 存储系统,是跨平台的非关系型数据库. Re ...

  8. 字符串拼接出现null的问题

    最近在开发的过程中遇到这样的问题,原因是在做一个需求的时候,要求将解密的号码和前缀进行拼接.一开始在这个拼接的过程中,没有考虑到数据校验的问题,因为有可能他的前缀或者其他需要拼接的字段在前端传递的过程 ...

  9. VUE实现富文本编辑以及组件传值的使用总结

    VUE实现使用富文本编辑,如下图: 实现这个富文本编辑需要以下步骤: 第一步:安装编辑器组件 npm install vue-quill-editor –-save第二步:创建一个Ue.vue的文件, ...

  10. Vue学习笔记-Vue.js-2.X 学习(七)===>脚手架Vue-CLI(路由Router)

    脚手架Vue-CLI(路由Router) 一 按装(通过新创建脚手架按装),如果在原来的脚手架上按装直接进图型化界面vue ui的插件按装. 二 使用(上面按装下面步骤自动会生成) 第一步:导入路由对 ...