wei/unit_1&2/full_name.py

26 lines
578 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

first_name ="ada"
last_name = 'lovelace'
#f是format设置格式
full_name =f"{first_name} {last_name}"
print(full_name)
print(f'hello {full_name}')
#可以使用制表符 \n \t
print('asd\nsdfjlj\takjfa\n\tadfkjkj')
#rstrip删除右边空格
#lstrip删除左侧空格
#strip 删除两侧空格
favorite_language = ' python '
print(favorite_language)
print(favorite_language.rstrip())
print(favorite_language.lstrip())
print(favorite_language.strip())
#removeprefix可用于删除前缀
nostarch = 'https://www.baidu.com'
print(nostarch.removeprefix('https://'))