11 12 13 14 py single quote string, double quote string and escape
Lesson 11 Single quote strings, double quote strings, and escape characters #Single quote strings, double quote strings, and escape characters print ('Hello World') print ('Hello World') print ('Let's go! ")print ('"OK"')print ('H',\"W\")-------------------------- "OK"'H',"W"//There is no essential difference between single quotation marks and double quotation marks in py, but print is used to highlight the respective symbols.("hello 'world'")print ('hello "world"')--------------------hello 'world'hello "world" What if we want to print both single and double quotes?("hello,'w'\"o\"rld") The output result is hello,'w'"o"rld----------------------------------------------("Hello", "world","Hello World")x = "Hello"y = "World"print (x + y + x)----------------------------------------------- #indicates world to next line print (str(1234) + "\n" + str(4321))#We want to output\n as it is. There are 3 methods #Method 1: Use repr function print (repr("Hello\nWorld"))#Method 2: Output\print using escape characters ("Hello\\nWorld")#Method 3: Prefix the string with rprint (r"Hello\nWorld")----------------------------------------Lesson 14 Long String #Long String '''""""print(""Hello World"") print("" HelloABC "")print("Hello \\World")-----------------------------