Python创建字符串

Python创建字符串:

  一般情况下可以使用 ' 或 " 创建字符串 或 使用引用字符串变量 或 字符串表达式。

# 字符串的创建
# 使用 ' 或 “ 进行创建
strs = 'ABCDEFG'
print(strs)
# ABCDEFG

strs = "ABCDEFG"
print(strs)
# ABCDEFG

# 使用变量进行赋值
strs_two = strs
print(strs_two)
# ABCDEFG

# 使用字符串表达式进行赋值
a = 'ABCD'
b = 'EFG'
c = a + b
print(c)

2020-02-08

原文地址:https://www.cnblogs.com/hany-postq473111315/p/12275504.html