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

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)
主站蜘蛛池模板: 阜平县| 祥云县| 黑龙江省| 新晃| 武隆县| 宜川县| 车致| 德兴市| 民勤县| 朔州市| 庄河市| 盐山县| 新乐市| 龙胜| 临湘市| 公安县| 余江县| 商丘市| 梨树县| 灵寿县| 威远县| 珲春市| 东光县| 区。| 建始县| 霍州市| 昭平县| 巴里| 柳河县| 长阳| 武汉市| 灌云县| 额尔古纳市| 余干县| 松桃| 景德镇市| 攀枝花市| 德钦县| 长白| 吉林市| 定安县|