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

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)
主站蜘蛛池模板: 盐城市| 青田县| 齐河县| 普安县| 酉阳| 灵宝市| 桂平市| 子长县| 申扎县| 镇远县| 凯里市| 云林县| 华亭县| 平遥县| 保定市| 通许县| 滨海县| 内江市| 龙泉市| 当雄县| 怀来县| 乳源| 云浮市| 建湖县| 休宁县| 定襄县| 额尔古纳市| 乌苏市| 东乡| 芜湖县| 徐水县| 弥勒县| 吕梁市| 隆尧县| 阿勒泰市| 将乐县| 永吉县| 高淳县| 广宗县| 呈贡县| 白玉县|