-
Notifications
You must be signed in to change notification settings - Fork 0
/
chap112.py
36 lines (29 loc) · 947 Bytes
/
chap112.py
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
print("Hello Python interpreter!")
print("Hello World!")
message = "Hello Python World!"
print(message)
name = "ada lovelace"
print(name.title()) # 单词首字母大写
print(name.upper())
print(name.lower())
first_name = "ada"
last_name = "lovelace"
full_name = first_name + " " + last_name
print(full_name)
print("Hello, " + full_name.title() + "!")
message = "Hello, " + full_name.title() + "!"
print(message)
print("Python")
print("\tPython") # 制表符\t
print("Languages:\nPython\nC\nJavaScript") # 换行符\n
print("Language:\n\tPython\n\tC\n\tJavaScript")
favorite_language = " python "
print(favorite_language)
print(favorite_language.rstrip()) # 去掉右边right空白
print(favorite_language.lstrip()) # 去掉左边left空白
print(favorite_language.strip()) # 去掉两边的空白
favorite_language = favorite_language.strip()
print(favorite_language)
message = " \t Adss "
print(message)
print(message.strip())