Python tutorial 07: Single Line String in Python Programming By Manish Sharma
Key Takeaways
Handles single line string in Python using single and double quotes
Full Transcript
remember when I said that we will discuss the concepts of single and double quotes in a separate video this command into a pair of single or double quote we will discuss more about the single and double quote concept in a separate video anyways today's study when I do that boo subordinate i am manish from rebellionrider.com and welcome to another amazing Python video today in this tutorial we will learn the concepts of the strings and string literals in Python so what are strings in computer programming language the strings are nothing but a single dimension array of characters in easy words you can define a string as a sequence of characters for example rebellion writer is a string made up of fourteen alphabetic characters and a white space which in total becomes 15 characters thus we can say that rebellion writer is a sequence of 15 characters which makes it eligible to be called a string a string can be categorized as a single line string and a multi-line string let's just focus on single line string in this video and save the multi line for the next one great every programming language has its own way of handling our strengths some of them are lenient while others are rigorous let's see how easy it is to handle a string in Python programming language but before that go ahead and press that thumbs up button and like this video most importantly subscribe to the channel if you haven't already as I am aiming for one lakh subscribers this year let's start in Python programming language there are multiple ways of handling a string among those the most common are including the string in single quotes and enclosing the string in double quotes apart from these two options Python interpreter provides us one more way which is for handling multi-line strings said earlier we will discuss it in the next video for now let's learn when to use the single quotes and double quotes okay right on your screen you can see three different examples of strings let's see how are they different from each other and how can we deal with them using Python programming language the first string which is I'm learning Python from rebellionrider.com is a simple string as it does not contain any special punctuation sign the second string which is what's up Internet contains a special punctuation sign which is apostrophe at the starting of the string while the third string which is I am going to be a Python programmer very soon contains a phrase in the middle of the string which is enclosed into a pair of double quotes now let's do the demonstration and see how to deal with these strings for this demonstration my choice of editor will be Adam editor you can use whatever editor you want let's start with the first one the simple string in case of simple string which does not involve any special punctuation science the choice of using quotation mark completely depends on you you can enclose the string either in single quotes or in double quotes for this string I will use the single quotes let's see the output here we got the desired output without any errors now let's move on to our second string the second string contains a punctuation mark which is an apostrophe sign this apostrophe sign will require our special attention let me explain you why whenever python interpreter starts processing a string it looks for quotation mark it could either be single quote or double quote the opening code indicates the starting of the string and closing code indicates the end of the string if either of these committing then it will raise an Elan which will end up in an error so what does it have to do with our second string to understand that let's write the code and see what do we get let's see the output as an output we got a syntax error so the question here is why this error let's try to understand what exactly happened here so I enclose to the strain into a pair of single quotes when the interpreter starts it comes across with the opening code which indicates the starting of the string and as it proceeds it encounters the apostrophe sign the interpreter translate this apostrophe sign as a closing single code and that's where the problem arises now when the interpreter moves ahead it finds rest of the string which is neither enclosed in a single code nor in a double code which causes the error so how to solve it the easiest way is to enclose this entire string into a pair of double quotes instead of single this way the interpreter will treat the opening double code as a starting of this string and we'll look for the closing double code sign for the end of the string any punctuation mark that comes in the middle will be bypassed now let's see if this string gets printed as is intended or not here is the output which is exactly the same as we desired so in simple words if you ever have to print a string which contains punctuation marks like apostrophe then enclose that string into a pair of double quotes now let's move on to our third string so far you must have gotten the idea of how Python handles the strings right so let's do one thing right now you can see the third string on your screen now I want you to pause this video right here and comment how to print this string on your Python prompt have you done it great now let's see how many of you have got it right so the string is I am going to be a Python programmer very soon this is again a simple string except that it has a phrase in between which is enclosed in double quotes we just need to make sure that these double quotes get translated as they intended to be in such scenario where you want to print a string which contains punctuation marks like double quotes then always includes your string in a pair of single quotes that we the opening single quote will indicate the starting of the string an interpreter will look for the closing single quote sign which will indicate the end of your string any punctuation mark that comes in the middle will be bypassed let me show you let's see the output here is our output which is our sentence with fries Python programmer enclosed in double quotes exactly as we wanted so that's how we use single and double quotes to work with single line string in Python programming now it's time for you to evaluate yourself I want you to go ahead and write Python programs to print these strings which are flashing on your screen let's see how much you learned that's it for today hope you learned something new please keep this video a thumbs up and share it with your friends and subscribe to the channel for more such interesting tutorials thanks for watching this is manish from rebellionrider.com
Original Description
Learn when and Where to use Single Quote & Double Quote to handle single line string in Python Programming by Manish Sharma
------------------------------------------------------------------------
►►►LINKS◄◄◄
Blog: http://bit.ly/py-07
Previous Tutorial
► How to customize the script plugin
https://youtu.be/urG8KTdDK4Y
-------------------------------------------------------------------------
►Make sure you SUBSCRIBE and be the 1st one to see my videos!
-------------------------------------------------------------------------
►►►Find me on Social Media◄◄◄
Follow What I am up to as it happens on
https://www.facebook.com/TheRebellionRider/
https://twitter.com/rebellionrider
http://instagram.com/rebellionrider
https://plus.google.com/+Rebellionrider
http://in.linkedin.com/in/mannbhardwaj/
You can also Email me at
for E-mail address please check the About section
Please please LIKE and SHARE my videos it makes me happy.
Thanks for liking, commenting, sharing and watching more of our videos
This is Manish from RebellionRider.com
♥ I LOVE ALL MY VIEWERS AND SUBSCRIBERS
#PythonWithRebellionRider #PythonProgramming
Watch on YouTube ↗
(saves to browser)
Sign in to unlock AI tutor explanation · ⚡30
Playlist
Uploads from Manish Sharma · Manish Sharma · 0 of 60
← Previous
Next →
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Oracle Database tutorials 1: How to install Oracle Database 11g on windows 7
Manish Sharma
Oracle Database tutorials 2:How To install SQL Developer on windows 7
Manish Sharma
Oracle Database tutorials 3:How to enable Line numbers in SQL Developer.
Manish Sharma
Oracle Database tutorials 4: database connectivity using SQL developer and command prompt
Manish Sharma
Oracle Database tutorials 5: how to Fetch Data using SELECT - SQL statement by Manish Sharma
Manish Sharma
Oracle Database11g tutorials 6 | | How to use Concatenation operator, character String
Manish Sharma
Oracle Database11g tutorials 7 | |SQL DISTINCT keyword || SQL tutorials
Manish Sharma
Canon EOS 600D 2 lens kit/Canon rebell EOS T3i 2 lens kit Unboxing
Manish Sharma
First look: ORACLE CERTIFIED ASSOCIATE (OCA) CERTIFICATE - ORACLE DATABASE ADMINISTRATOR
Manish Sharma
Oracle Database11g tutorials 8 || SQL DISTINCT with multiple columns |SQL Distinct with Two columns
Manish Sharma
Oracle Database11g tutorials 9 || What is archive log mode and how to enable archive log mode
Manish Sharma
Oracle Database11g tutorials 10 || SQL Single Row Function (SQL Functions )
Manish Sharma
Oracle Database11g tutorials 11: SQL case manipulation function in Oracle Database
Manish Sharma
how to add channel trailer and section on your youtube channel 2014
Manish Sharma
Oracle Database11g tutorials 12 || SQL Concat Function - SQL character manipulation function
Manish Sharma
Oracle Database11g tutorials 13 || SQL substr function / SQL substring function
Manish Sharma
Oracle Database11g tutorials 14 : How to CREATE TABLE using sql developer and command prompt
Manish Sharma
SQL tutorials 15 || How To CREATE TABLE using enterprise manager 11g
Manish Sharma
Oracle Database11g tutorials 16: How to uninstall oracle 11g from windows 7 64 bit
Manish Sharma
ORACLE CERTIFIED PROFESSIONAL(OCP) CERTIFICATE First look - ORACLE DATABASE ADMINISTRATOR
Manish Sharma
Plantronics audio 655 USB headset with Mic Unboxing and Review and Plantronics audio 655 Mic test
Manish Sharma
SQL tutorials 17: SQL Primary Key constraint, Drop primary Key
Manish Sharma
SQL tutorials 18: SQL Foreign Key Constraint By Manish Sharma
Manish Sharma
SQL tutorial 19: ON DELETE SET NULL clause of Foreign Key By Manish Sharma (RebellionRider)
Manish Sharma
SQL tutorials 20: On Delete Cascade Foreign Key By Manish Sharma (RebellionRider)
Manish Sharma
SQL tutorial 21: How To Rename Table in SQL using ALTER TABLE statement By Manish Sharma
Manish Sharma
SQL tutorial 22: How to Add / Delete column from an existing table using alter table
Manish Sharma
SQL tutorial 23: Rename and Modify Column Using Alter Table By Manish Sharma (RebellionRider)
Manish Sharma
SQL tutorial 24 :SQLJoins- Natural Join With ON and USING clause By Manish/Rebellionrider
Manish Sharma
Oracle Database11g tutorials 25: How to install Oracle Database 11g Express Edition R2 on Windows 7
Manish Sharma
SQL tutorial 26: Introduction to SQL Joins in Oracle Database
Manish Sharma
Vidcon 2014 YouTube Fan Funding: How to enable fan funding on YouTube Channel
Manish Sharma
SQL tutorial 27: Right Outer Join in SQL by Manish Sharma for RebellionRider
Manish Sharma
SQL tutorial 28: Left Outer Join By Manish Sharma / RebellionRider
Manish Sharma
SQL tutorial 29: Full Outer Join with example By Manish Sharma/ RebellionRider
Manish Sharma
SQL tutorial 30: Inner Join In SQL by Manish Sharma/RebellionRider
Manish Sharma
SQL tutorial 31 : SQL Cross Join In Oracle Database By Manish Sharma from RebellionRider
Manish Sharma
SQL tutorial 32: How To Insert Data into a Table Using SQL Developer
Manish Sharma
SQL tutorial 33:How To Insert Data into a Table Using SQL INSERT INTO dml statement
Manish Sharma
SQL tutorial 34: How to copy /Insert data into a table from another table using INSERT INTO SELECT
Manish Sharma
SQL tutorial 35: DELETE and TRUNCATE how to delete data from a table
Manish Sharma
SQL tutorial 36: how to create database using database configuration assistant DBCA
Manish Sharma
SQL tutorial 37: How to create NEW USER account using Create User statement in Oracle database
Manish Sharma
SQL tutorial 38: How to create user using SQL Developer in Oracle database
Manish Sharma
SQL tutorial 39: How to create user in oracle using Enterprise Manager
Manish Sharma
SQL tutorial 40: DBA Trick, How to drop a user when it is connected to the database
Manish Sharma
Motorola Moto G 2nd Generation / G2 Unboxing and Review
Manish Sharma
SQL tutorial 41: How to UNLOCK USER in oracle Database
Manish Sharma
SQL tutorial 42: How to Unlock user using SQL Developer By Manish Sharma RebellionRider
Manish Sharma
SQL tutorial 43: How to create an EXTERNAL USER in oracle database By Manish Sharma RebellionRider
Manish Sharma
SQL tutorial 44: How to import data from Microsoft Excel to Oracle Database using SQL Developer
Manish Sharma
SQL tutorial 45: Introduction to user Privileges in Oracle Database By Manish Sharma RebellionRider
Manish Sharma
SQL tutorial 46: What are System Privileges & How To Grant them using Data Control Language
Manish Sharma
SQL tutorial 47: How to Grant Object Privileges With Grant Option in Oracle Database
Manish Sharma
SQL tutorial 48: How to create Roles in Oracle Database
Manish Sharma
SQL tutorial 49: CASE - Simple Case Expression in Oracle Database (1/2)
Manish Sharma
SQL tutorial 50: CASE - Searched Case Expression In Oracle (2/2)
Manish Sharma
SQL tutorial 51: DECODE function in Oracle Database By Manish Sharma (RebellionRider)
Manish Sharma
Oracle Database Tutorial 52 : Data Pump expdp - How to Export full database using expdp
Manish Sharma
Oracle Database Tutorial 53 : Data pump expdp - How to Export tablespace in Oracle Database
Manish Sharma
🎓
Tutor Explanation
DeepCamp AI