"Hi my name is CodeSpace".lower()
# 'hi my name is codespace'
"hi my name is CodeSpace".upper()
# 'HI MY NAME IS CODESPACE'
import shutil;
shutil.copyfile('code_space_1.txt', 'code_space_2.txt')
list_demo[::-1]
even_list = [num for num in [1, 2, 3, 4] if num % 2 == 0]
# [2, 4]
print("Hello, World!", file=open('code_space.txt', 'w'))
list1 = [1,2,3]
list2 = [4,5,6]
list1.extend(list2)
# list1:[1,2,3,4,5,6]
dict1 = {"name" : "code_space"}
dict2 = {"size" : "20cm"}
dict1.update(dict2)
# dict1: {"name" : "code_space" , "size" : "20cm"}
quotient, remainder = divmod(11, 5)
# quotient:2,remainder:1
li = [4, 2, 3, 1]
li.sort()
# [1, 2, 3, 4]
sorted(li, reverse=True)
# [4, 3, 2, 1]
关注我,坚持每日积累一个技巧,长期坚持,我们将会不断进步。