python学习中错误总结:

关于python中的空格错误

一次在敲python时,编辑器不断报错

    for word in list(counter):
                             ^
IndentationError: unindent does not match any outer indentation level

就是感觉莫名其妙,明明是对齐的。
后来才发现,是python编辑器的 空格 和 tab键 造成的。

解决方法:
把正确代码的缩进拷贝下来,张贴到报错的地方。

编码报错:SyntaxError: Non-ASCII character ‘\xe3’ in file G:\test.py on line 2, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

解决方法:
删掉# -*- encoding : utf-8 -*-,改用# encoding: utf-8

tensorfolw运行中出现warn警告,禁止打印方法

2017-07-25 10:40:29.051142: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn’t compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-25 10:40:29.051175: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn’t compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-25 10:40:29.051180: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn’t compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations.
2017-07-25 10:40:29.051183: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn’t compiled to use AVX2 instructions, but these are available on your machine and could speed up CPU computations.
2017-07-25 10:40:29.051187: W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn’t compiled to use FMA instructions, but these are available on your machine and could speed up CPU computati
ons.

可以通过下列方法禁止打印:

import os
os.environ["TF_CPP_MIN_LOG_LEVEL"]='1'
 # 这是默认的显示等级,显示所有信息
os.environ["TF_CPP_MIN_LOG_LEVEL"]='2'
# 只显示 warning 和 Error  
os.environ["TF_CPP_MIN_LOG_LEVEL"]='3'
 # 只显示 Error  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值