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

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)
主站蜘蛛池模板: 余江县| 宜都市| 林西县| 化隆| 旅游| 美姑县| 即墨市| 襄汾县| 龙江县| 普宁市| 淮南市| 安新县| 凤冈县| 耒阳市| 沁源县| 孝感市| 牡丹江市| 盐池县| 方正县| 梁平县| 隆林| 东安县| 武隆县| 秦安县| 凤城市| 津市市| 会宁县| 凌源市| 平定县| 和平区| 保德县| 依安县| 苍南县| 镇坪县| 云南省| 社会| 阿瓦提县| 阿鲁科尔沁旗| 罗田县| 潍坊市| 光泽县|