• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
james1207

博客园    首页    新随笔    联系   管理    订阅  订阅

python中文注释及输出出错


    今天开始接触python,中文报错,你懂的,不细说。

    网上很多类似的解决方案,有不是很明确,例如:http://blog.csdn.net/chen861201/article/details/7706535

    方法有二,1、在代码开头加#coding=utf-8(注意要加#)

                        2、还是在代码开头加#-*- coding: utf-8 -*-(亲,还是要注意要加#)


   

#-*- 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 

 

 

 

posted @ 2013-09-09 19:29  Class Xman  阅读(283)  评论(0)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3