python3 str_input.py

"""
Knowledge points:
1.
String sections: variable [the header: Tail index: step]
2.
"+", You can concatenate strings.
3.
"\ N", to indicate a new line.
4.
r '', represents the original string, raw string, the escape does not occur.
"""
s = 'Runoob'

print(s)  # Runoob
print(s[0:-1])  # Runoo
print(s[0])  # R
print(s[2:5])  # noo
print(s[2:])  # noob
print(s * 2)  # RunoobRunoob
print (s + 'hello') # Runoob hello
print('------------------------------')
print('hello\nrunoob')
# hello
# runoob
print(r'hello\nrunoob')
# hello\nrunoob

# "\ N \ n" before suggesting output will output two new blank line.
# Once the user presses the enter key, the program exits.
( "Exit after \ n \ n press the enter key.") Input

Guess you like

Origin blog.csdn.net/weixin_42193179/article/details/91356942