目录
6-1 一个简单的注释抽取程序
def GetComment(line):
comment_index = line.find('#')
if comment_index != -1:
return line[comment_index:].strip() # 去除 '#' 后返回并移除前导和尾随空白
else:
return ''
7-1 产生每位数字相同的n位数
A,B=map(lambda x: x.strip(),input().split(','))
print(A*int(B))
7-2 统计单词的个数
n=input().split()
cnt=len(n)
print(f'count = {cnt}')
7-3 输出10个不重复的英文字母
s = input()
b = []
for i in s:
if i.isalpha() and (i.upper() not in b) and (i.lower() not in b):
b.append(i)
str = "".join(b)
if len(str)>=10:
print(str[:10])
else:
print("not found")