© Sanjib Sinha 2017

Sanjib Sinha, Beginning Ethical Hacking with Python, 10.1007/978-1-4842-2541-7_16

16. String Methods

Sanjib Sinha

(1)Howrah, West Bengal, India

In Python a string is an object. As an instance of “class string” it can call any function or property. We can change a string into upper case by simply calling a function upper().

Let us open our terminal and type this:

<code>hagudu@hagudu-H81M-S1:∼$ python3                Python 3.4.0 (default, Jun 19 2015, 14:20:21)                [GCC 4.8.2] on linux                Type "help", "copyright", "credits" or "license" for more information.                >>> 'this is a string'                'this is a string'                >>> s = 'this is a string'                >>> s                'this is a string'                >>> s.upper()                'THIS IS A STRING'                >>> s = 'this is a string now we are going to add an integer into it ...

Get Beginning Ethical Hacking with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.