import os
def SearchDir(path, z=[]):
if os.path.exists(path):
if os.listdir(path):
for d in os.listdir(path):
if os.path.isdir(os.path.join(path, d)):
z += [(os.path.join(path, d))]
SearchDir(os.path.join(path, d), z)
else:
return print('The directory is empty')
else:
return print('The directory does not exist')
return z
path = r'f:\Python-pyramid\farm'
print(SearchDir(path))
m = re.search('<br/>(.*)<br/>', text)
if m:
print(m.group(1))
media = json.loads(api.json)
media['users'][0]['num']
list = []
result = 1
for i in input:
list.append(i)
result = 1
list = [i for i in input]
return Request(link, formdata={'year': str(data)}, callback=self.parse_year
def parse(self):
result = []
for data in years[1:8]:
result.append(Request(link, formdata={'year': str(data)}, callback=self.parse_year))
return result
if int(record[0]) < time_score:
record[0] = time_score
record[0] = encryption(key, mode, iv, record[0])
def encryption(key, mode, iv, record):
...
record[0] = encryptor.encrypt(record[0]) # record - не список! Это число!
class Vehicle(API):
def get(self, endpoint='/tanks/stats/', lang='ru', fields='', account_id=''):
if type(fields) is list:
fields = self._format_fields(fields)
return self._api_call(endpoint=endpoint,
fields=fields,
language=lang,
account_id=account_id)
vehicle = Vehicle(...)
stats = vehicle.get()
achievements = vehicle.get('/tanks/achievements/')
if условие:
действия при выполнении условия
elif услоие:
действия при выполнени услвоия elif
else:
действия во всех остальных случаях
void main()
{
printf('Something');
f++; v *= 2;
printf('Something else');
foo(); }