1. 将数字强制转换成字符串
i = 1000
str1 = "hello"
print str1 + str(i)
2. 格式化成字符串
i = 1000
str1 = "hello"
print "%s %d" %(str1, i)
1. 将数字强制转换成字符串
i = 1000
str1 = "hello"
print str1 + str(i)
2. 格式化成字符串
i = 1000
str1 = "hello"
print "%s %d" %(str1, i)
指法入门
python基础知识 print函数: &n
1.几种输入字符串的方式:1.1.双引号的使用:字符串一般依照单引号的开始与结尾来判断,当单引号里面又包含单引号时,就不能区分了,所以此时应用双引号。>>> person = "my name is 'Lee'.">>> person"my name is 'Lee'."1.2. 转义字符:在字符串中既需要使用单引号又需要使用双引号时,就要使用转义字符,使用
举报文章
请选择举报类型
补充说明
0/200
上传截图
格式支持JPEG/PNG/JPG,图片不超过1.9M