Python With Excel and Text Strings
Python Text
The difference between single quotes ‘‘ vs triple quotes ‘‘‘ ‘‘‘ can be very useful with complex Python text.
Explanation:
Above, we set the newspaper_quote variable to a quote that a director said, however the use of single quotes within a string that was declared with single quotes gives an error when we print it — because Python assumes that the start of the variable is the first word (The) and will look for the next quote to close the variable’s quote (to the right of said). Therefore, the word “the movie” will not be treated as a text but rather just floating code that will give the error. The next lesson will show how to fix this.