0% found this document useful (0 votes)
10 views

Python Strings

The document discusses strings in Python, which are collections of characters within single or double quotes. It explains that anything within quotes is considered a string, and how to convert other data types to strings using str(). It also demonstrates concatenating strings and provides links to Python documentation on strings.

Uploaded by

aaryani6991
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

Python Strings

The document discusses strings in Python, which are collections of characters within single or double quotes. It explains that anything within quotes is considered a string, and how to convert other data types to strings using str(). It also demonstrates concatenating strings and provides links to Python documentation on strings.

Uploaded by

aaryani6991
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Python Strings

Anything between the single or double quotes in python code is considered as ‘strings’ or ‘str’.

A string is just a collection of characters (numbers, alphabets, special char etc) within single or
double quotes.

String1 = 'Hello, Great Learning'

String2 = "Hello, Great Learning"

There is a keyword ‘str’

str
To convert any data point to string , use str(data_point)

number= 1234

str(number) # will give output as ‘1234’

The below code will give error as single quoted 1 will not be identified as a numeric value
[email protected]
9T6KVYUXDH'1'+1

This will concatenate the two strings

'1'+'1' # will give '11'

Please refer to official Python Documentation:

o https://docs.python.org/3/library/string.html
o https://docs.python.org/3/library/stdtypes.html#string-methods

Proprietary content. ©Great Learning. All Rights Reserved. Unauthorized use or distribution prohibited.

This file is meant for personal use by [email protected] only.


Sharing or publishing the contents in part or full is liable for legal action.

You might also like