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

Strings

A value with a string data type is simply a collection of characters. You've already seen a string data type in use from the hello world program that you created earlier, namely, Hello World!. String values are created in Python by writing the contents of a string inside quotation marks:

>> "your string here"

Two or more strings can be merged together or concatenated using the + operator:

>> "string 1 " + "string 2"
Python does not distinguish between single quotes and double quotes; however, the opening quotes must be the same as the closing quotes ( "This will not work').

I will cover string operations in detail in Chapter 5, Manipulating Text Data - An Introduction to Regular Expressions.

主站蜘蛛池模板: 江西省| 榆中县| 梨树县| 东莞市| 松潘县| 黑河市| 余姚市| 连云港市| 昌邑市| 古田县| 龙南县| 大安市| 健康| 天全县| 丰城市| 理塘县| 友谊县| 丽江市| 敖汉旗| 香格里拉县| 内黄县| 安宁市| 元江| 镇原县| 左权县| 横峰县| 江山市| 如皋市| 新绛县| 西乡县| 湟源县| 洪湖市| 涞水县| 九龙坡区| 东至县| 城固县| 抚州市| 瑞丽市| 高尔夫| 营山县| 秦皇岛市|