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

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)


照顾好自己,如果尚有余力,记得保护美好的东西,不畏不惧赤诚善良。

评论

^