码迷,mamicode.com
首页 > 编程语言 > 详细

python基础

时间:2016-03-05 13:05:31      阅读:160      评论:0      收藏:0      [点我收藏+]

标签:

 1 #coding=utf-8
 2 #print函数
 3 print 3, -1, 3.14159, -2.8
 4 #type函数
 5 print type(3), type(3.14159), type("123")
 6 #类型转换
 7 print int(3.14159), int(-2.8)
 8 print float(3), float(-1)
 9 #输出字符串
10 print "span" + "and" + "eggs"
11 str1 = "teacher"
12 str2 = "student"
13 print "I‘m a %s, not a %s"%(str1, str2)
14 s = "123"
15 print type(s) == str
16 #次方
17 print 3 ** 3
18 print 81 ** 0.5

技术分享

python基础

标签:

原文地址:http://www.cnblogs.com/wanderingzj/p/5244451.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!