报错信息
[root@chenbj ~]# python ip.py 192.168.1.1 File "ip.py", line 4SyntaxError: Non-ASCII character '\xe6' in file ip.py on line 4, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details翻译:SyntaxError:第4行文件ip.py中的非ASCII字符“\ xe6”,但未声明编码; 有关详细信息,请参阅http://www.python.org/peps/pep-0263.html
所以我们就要指定字符编码:养成良好习惯很重要.
[root@chenbj ~]# cat ip.py #!/usr/bin/env python# _*_ coding:utf-8 _*_