计算机网络/计算机科学与应用/系统/运维/开发

Python 字符串

# 字符串
# 定义字符串的三种方式
s1 = "Hello"
s2 = 'Python'


# 定义字符串
msg3 = "hello 意见是 \"你好\""
print(msg3)


# 字符串拼接  +
slogan = "hello" + "world"
print(slogan)
s1 = "python"
print("nihao: " + s1)


# str(int数字) 将int类的数字转为字符串
age = 18
print(str(age))
print(type(str(age)))


# 字符串格式化 %
s5 = "涛哥"
print("大家伙,我是 %s" % s5)


所有的努力,不是为了让别人觉得你了不起,而是为了能让自己打心眼里看得起自己。

评论

^