摘要: # 字符串拼接 # coding:utf-8 # 1.采用‘+’号的形式 # a = 'hello' # b = 'world' # c = a +' ' + b # print(c) # 2.采用格式化的形式 # a = "__" # b = 'name' # # "__name__" # # c = a + b + a # c = "%s%s%s" % (a,b,a) # prin... 阅读全文
posted @ 2019-07-06 21:01 水果、、 阅读(557) 评论(0) 推荐(0) 编辑
摘要: 1.在python中使用单引号或者双引号括起来的就是字符串。2. # 使用6个单引号或双引号 使字符串所见即所得3.在python2中,字符串分为两种类型,第一种是str,第二种是unicode,他们都是继承自basestring。4.在python3中,字符串分为两种类型,第一种是bytes,是p 阅读全文
posted @ 2019-07-06 20:47 水果、、 阅读(210) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 for row in range(1,10): for column in range(1,row+1): print("%d*%d=%d " % (column,row,column*row),end = '') print("") 阅读全文
posted @ 2019-07-06 13:57 水果、、 阅读(230) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # greet = 'hello world' # for in 遍历字符串 # for x in greet: # print (x) # ================================================== # greet = 'python papijiang papa mama' # cou... 阅读全文
posted @ 2019-07-06 13:35 水果、、 阅读(281) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # 打印1到10之间的整数,不要把5打印出来 # index = 0 # while index < 10: # index += 1 # if index ==5: # continue #退出此次循环 # print(index) # 打印1-10之间的所有奇数 # index = 0 # while index < 10: # i... 阅读全文
posted @ 2019-07-06 11:14 水果、、 阅读(787) 评论(0) 推荐(0) 编辑
摘要: # coding:utf-8 # break/continue 只能在循环中使用,不能在其它地方使用,while、for循环中可以使用 # num = 1 # while num num: print('太大') else: print ('恭喜您!答对啦') breakss 阅读全文
posted @ 2019-07-06 10:56 水果、、 阅读(368) 评论(0) 推荐(0) 编辑