赞
踩
周六:
- def find_number():
- for number in range(0,10000):
- if number % 5 == 0 or number % 6 == 0:
- if number % 5 != number % 6:
- ls.append(number)
- print(ls)
-
-
- ls = []
- find_number()
- def count_even():
- count = 0
- for index in range(0,len(ls)):
- if ls[index] % 2 == 0:
- count += index
- print(count)
-
-
- ls = [11,99,68,48,25,23,49,57,56,15,12]
- count_even()
- def get_wenjian(s):
- print("后缀名是:",s[s.rfind(".")+1:])
- s = input("请输入需要获取文件后缀的路径:")
- get_wenjian(s)
- ls = "以媒:特拉维夫汽车冲撞抗议人群涉事司机发声,称事件为意外事故"
- lis = ls.replace(",","\n")
- print(lis)
- ls = "特拉维 夫汽车冲撞 抗议人群涉事 司机发 声,称事件 为意 外事 故!"
- lis = ls.replace(" ","")
- print(lis)
- A = str(input("A同学喜欢的游戏名称:"))
- B = str(input("B同学喜欢的游戏名称:"))
- if A == B:
- print(A)
- else:
- print(A)
- print(B)
- def get_A():
- A = str(input("A同学喜欢的游戏名称:"))
- return A.upper
- def get_B():
- B = str(input("B同学喜欢的游戏名称:"))
- return B.upper
-
- def compare_game():
- if game1 == game2:
- print(game1)
- else:
- print(game1)
- print(game2)
-
- game1 = get_A()
- game2 = get_B()
- compare_game()
- time_number = str(input("请输入时间如“2008/08/08”:"))
- time = time_number.split("/")
- print(f"{time[0]}-{time[1]}-{time[2]}")
- def get_along():
- for index in range(0,len(along_number)):
- print(along_number[index],end="")
- print("\n")
-
- def get_inverse():
- for index in range(0,len(inverse_number)):
- print(inverse_number[index],end="")
-
- ls = "cabed"
- ls1 = list (ls)
- along_number = sorted(ls1)
- inverse_number = sorted(ls1,reverse = True)
- get_along()
- get_inverse()
- ls = "hello c java python"
- ls1 = ls.split(" ")
- ls2 = ls1[::-1]
- ls3 = " ".join(ls2)
- print(ls3)
- ls = "http://www.163.com?userName=admin&pwd=123456"
- ls2 = ls.split("?")
- for i in range(0,2):
- print(ls2[i])
- ls = ["瓦尔登湖","小王子","沉思录","活着","红楼梦","资本论","假如给我三天光明","了不起的盖茨比","我重生这个世界上获得未来的一切记忆之统治世界"]
- dit = {"瓦尔登湖":"梭罗","小王子":"圣埃克苏佩里","沉思录":"马可·奥勒留","活着":"余华","红楼梦":"曹雪芹","资本论":"马克思","假如给我三天光明":"海伦·凯勒","哈姆雷特":"莎士比亚","了不起的盖茨比":"弗·司各特·菲茨杰拉德","我重生这个世界上获得未来的一切记忆之统治世界":"李华"}
-
- for index in range(0,len(ls)):
- lon = ls[index]
- if len(lon) > 10:
- lon = lon[0:9] + "..._" + str(dit[ls[index]])
- ls[index] = lon
- print(ls)
- ls = list(str(input("请输入你想要说的话:")))
- dit = "呵"
- for index in range(0,len(ls)):
- if dit == ls[index]:
- print(index)
- ls = "ta很邪恶"
- ls1 = ls.replace("邪恶","**")
- print(ls1)
- ls = str(input("请输入你人文的回文字符串"))
- ls2 = ls[::-1]
- print(ls2)
- if ls == ls2:
- print("这是一个回文字符串")
- else:
- print("这不是")
- import glob
- import os
- os.chdir(“./”)
- for file in glob.glob(“*.py”):
- print file
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。