python中文註釋及輸出出錯


    今天開始接觸python,中文報錯,你懂的,不細說。python

    網上不少相似的解決方案,有不是很明確,例如:http://blog.csdn.net/chen861201/article/details/7706535app

    方法有二,一、在代碼開頭加#coding=utf-8(注意要加#).net

                        二、仍是在代碼開頭加#-*- coding: utf-8 -*-(親,仍是要注意要加#)code


   

#-*- coding: utf-8 -*-
#coding=utf-8
#hello world
print 'hello world'
'''
#if
if 1:
  print 'python'
else:
  print 'learning new language is a very happy things'
'''
#while循環
x=1
while x<=100:
  print 'I love python 第%d遍' %x
  print 'the second way to show '+str(x)
  x += 1 
相關文章
相關標籤/搜索