3.13
s="Python String"
print(s.upper())
print(s.lower())
print(s.find('i'))
print(s.replace('ing','gni'))
print(s.split(' '))
3.14
print("{:>15s}:{:<8.2f}".format("Length",23.87501))
3.15
number=389
print(f"二进制:{bin(number)}")
print(f"八进制:{oct(number)}")
print(f"十进制:{number}")
print(f"十六进制:{hex(number)}")
char=chr(number)
print(f"Unicode:{char}")
3.6
import time
def text_progress_bar():
print("Starting",end='')
for i in range(10):
print(".",end='',flush=True)
time.sleep(0.2)
print("Done!")
text_progress_bar()
3.7
import time
while True:
for i in ["/","--","|","\","|"]:
print("%s\r"%i)
time.sleep(0.1)
3.8
from tqdm import tqdm
form time import sleep
def tqdm_progress_bar():
for i in tqdm(range(1,100)):
sleep(0.01)
tqdm_progress_bar()