/etc/postgresql/9.5/main/pg_hba.conf
local database1 user1 trust
(ven) md@md ~/.MINT18/code/python/project0/ven/bin $ psql -U user1 database1
psql: FATAL: Peer authentication failed for user "user1"
(ven) md@md ~/.MINT18/code/python/project0/ven/bin $
md@md ~/.MINT18/code/python/project0 $ python3.7 -m venv project_env
Команда 'python3.7' не найдена, возможно вы имели в виду:
Команда 'python3.5' из пакета 'python3.5-minimal' (main)
python3.7: команда не найдена
md@md ~/.MINT18/code/python/project0 $ python3 -m venv project_env
md@md ~/.MINT18/code/python/project0 $
md@md ~/.MINT18/code/python/project0/project_env/bin $ source activate
(project_env) md@md ~/.MINT18/code/python/project0/project_env/bin $ python -V
Python 3.5.2
(project_env) md@md ~/.MINT18/code/python/project0/project_env/bin $ python3 -V
Python 3.5.2
(project_env) md@md ~/.MINT18/code/python/project0/project_env/bin $ deactivate
#!/usr/bin/env python3
class Obj():
def __init__(self, word):
self.word = word
def __iter__(self):
for l in self.word:
yield l
obj = Obj('sergey')
it = iter(obj)
print(type(it))
n = next(it)
print(type(n))
print(n, len(n))
n = next(it)
print(type(n))
print(n, len(n))
n = next(it)
print(type(n))
print(n, len(n))
n = next(it)
print(type(n))
print(n, len(n))
n = next(it)
print(type(n))
print(n, len(n))
n = next(it)
print(type(n))
print(n, len(n))
<type 'generator'>
<type 'str'>
('s', 1)
<type 'str'>
('e', 1)
<type 'str'>
('r', 1)
<type 'str'>
('g', 1)
<type 'str'>
('e', 1)
<type 'str'>
('y', 1)
Генератор возвращает объект по которому можно итерироваться,
"styles": [
"apps/bla/src/styles.scss"
],
body { background: $red-color; }
def registration(request):
print('----', request.method)
if request.method == 'OPTIONS':
response = JsonResponse([{"registration_successful": True}], safe=False)
response['Access-Control-Allow-Origin'] = '*'
response['Access-Control-Allow-Methods'] = 'POST'
return response
elif request.method == 'POST':
print('----', request.POST['username'])
username = request.POST['username']
email = request.POST['email']
password = request.POST['password']
print('===', username, email, password)
if _reg_data_exist(username, email, password):
user = User.objects.create_user(username, email, password)
user.save()
без sudo пробовал выполнять. Результат тот же самый:
В журнале, на который вы указали последние записи такие:
последняя строка относится к приведённой выше команде(без sudo которая)