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

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.

主站蜘蛛池模板: 田阳县| 项城市| 宣城市| 罗源县| 邢台市| 台江县| 韶山市| 芜湖市| 筠连县| 孝感市| 荃湾区| 新郑市| 福清市| 汝城县| 庄河市| 余干县| 元阳县| 潞西市| 安宁市| 玉屏| 许昌市| 德令哈市| 嵩明县| 拜城县| 彰化县| 涿鹿县| 体育| 石门县| 宁明县| 常山县| 呼和浩特市| 枞阳县| 新密市| 搜索| 滨海县| 托克托县| 文登市| 东兴市| 莲花县| 朔州市| 宁强县|