利志分享
fast_forward
view_headline
go教程
clickhouse教程
python教程
shell教程
原创杂文
打赏
go教程
clickhouse教程
python教程
shell教程
原创杂文
打赏
python基础
python输入输出及编码和注释
python的数据基础数据类型
python的list和tuple数据结构
python的条件语句和循环
python的dict和set的使用
python的函数使用
python的io操作
python操作mysql
python的协程使用
python 的 gevent 协程库使用
目录
python基础
python输入输出及编码和注释
python的数据基础数据类型
python的list和tuple数据结构
python的条件语句和循环
python的dict和set的使用
python的函数使用
python的io操作
python操作mysql
python的协程使用
python 的 gevent 协程库使用
python输入输出及编码和注释
阅读:2887
分享次数:0
# 1.py # # 对应python中文编码问题如下加上 #coding=utf-8 或者 # -*- coding: utf-8 -*- #coding=utf-8 # 对于python的注释有两种 # 一个是用 # 注释 一个是多行注释用 ''' ''' 下面有例子 ''' 这里是多行注释 ''' # 打印一个hello world # 注意文件一定要是utf8 无bom编码 不然会执行报异常的错误 异常错误如下:SyntaxError: Non-ASCII character '\xe6' in file 1.py on line 4, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details print 'hello world' # print 多个字符串用,号隔开,输出的时候用的空格隔开,如果不用,隔开,则输出的字符串是相连的 print 'this is a boy','jump','the lazy dog' print 'i am' 'boy' # 从命令行输入数据 test = raw_input() print '这里是打印输入结果:', test ''' 下面是这个是运行结果: hello world this is a boy jump the lazy dog i amboy 5 这里是打印输入结果: 5 '''
感觉本站内容不错,读后有收获?
attach_money
我要小额打赏,鼓励作者写出更好的教程
扫码关注公众号:talk_lizhi