Читать книгу Introduction to Python Programming for Business and Social Science Applications - Frederick Kaefer - Страница 81

String Objects

Оглавление

Even though string objects in Python are more basic data types, they have some similarities to List objects. Strings are sequences of characters, and we can access each character of a string individually, just as we can access each object in a list, using an index. A character is the smallest possible component of a text, and characters vary depending on the language and context used (Python Software Foundation, 2019, “Unicode HOWTO”). For example, if a variable str_message had the value “Hey, Taxi!” it would comprise 10 characters and you could index each character in the string using the index values 0 through 9. In this example, str_message[2] would be the third character, which is “y.”

Introduction to Python Programming for Business and Social Science Applications

Подняться наверх