import re
sep = re.compile(r',\s*')
def _sep(s):
s = sep.sub(' ', s).strip()
return s.split(' ')
l = list(map(eval,_sep(input())))
if len(l) < 3:
print(False)
else:
m = max (l)
i = l.index(m)
if i == len(l)-1:
print(False)
else:
print(all(x < y for x,y in zip(l[:i],l[1:i+1])) and all(x > y for x,y in zip(l[i:-1],l[i+1:])))
import os, re
directory = r'H:\课件\Python'
space = re.compile(r'\s')
def _sum(py):
temp = (space.sub('', line) for line in py)
s = sum(line[0] != '#' for line in temp if line)
#print (s)
return(s)
s = 0
for p in os.walk(directory):
for f in p[2]:
path = os.path.join(p[0],f)
fname,ext = os.path.splitext(f)
if ext == '.py':
#try:
#with open(path) as py:
#print(path)
#print(list(py))
#s += _sum(py)
#except UnicodeDecodeError:
with open(path, encoding='utf-8') as py:
s += _sum(py)
print(s)
Comments NOTHING