官术网_书友最值得收藏!

String literals

A string literal must be written between quotes. The following line of code demonstrates a string literal. This example does not do anything since the literal is a value that is never assigned to a variable:

"hello, world"

Without being assigned to a variable, this string can't be printed. String literals don't have to be assigned to a variable to be useful; they can be passed directly to a function such as print. The following code demonstrates both of these cases:

print ("Print a string literal, used in place")
message = "Print a string assigned to a variable"
print(message)
主站蜘蛛池模板: 遂宁市| 砚山县| 新源县| 新营市| 平塘县| 黄石市| 汾阳市| 徐闻县| 商洛市| 隆子县| 武汉市| 青铜峡市| 简阳市| 庆安县| 玉溪市| 潞城市| 阿拉善左旗| 府谷县| 黑河市| 平果县| 渝北区| 富平县| 新巴尔虎右旗| 清丰县| 应用必备| 临江市| 安达市| 黑山县| 东乌珠穆沁旗| 海城市| 阿勒泰市| 定兴县| 法库县| 呼图壁县| 星座| 盐津县| 马山县| 馆陶县| 玉溪市| 射洪县| 镇赉县|