GROUP BY
и ORDER BY
.+----+-------+
| id | value |
+----+-------+
| 1 | alpha |
| 2 | delta |
| 3 | beta |
| 4 | gamma |
| 5 | beta |
| 6 | beta |
| 7 | alpha |
| 8 | beta |
+----+-------+
SELECT `value` , COUNT( * ) AS `cnt`
FROM `testtable2`
GROUP BY `value`
ORDER BY `cnt` DESC
+-------+-----+
| value | cnt |
+-------+-----+
| beta | 4 |
| alpha | 2 |
| delta | 1 |
| gamma | 1 |
+-------+-----+
#LearnMore[href*="/cash-back-credit-cards/chase-freedom-unlimited"]
with open('passwords.txt', 'r') as f:
for line in f:
line = line.strip()
login, password, domain = line.split(':')
print('login: %s, pass: %s, domain: %s' % (login, password, domain))
# coding: utf8
и добавляйте перед строкой символ u
:# coding: utf8
print u'Привет питон!'
coding
и u''
уже не нужны. from datetime import datetime, timedelta
import calendar
date = datetime.now()
days_in_month = calendar.monthrange(date.year, date.month)[1]
date += timedelta(days=days_in_month)
print(date)
errors = list(map(str.strip, map(str, validator.iter_errors(js))))
strip
используйте rstrip
. requests
:import requests
url = 'https://route.cit.api.here.com/routing/7.2/calculateroute.json'
params = {
'app_id': 'DemoAppId01082013GAL',
'app_code': 'AJKnXv84fjrb0KIHawS0Tg',
'waypoint0': 'geo!52.5,13.4',
'waypoint1': 'geo!52.5,13.45',
'mode': 'fastest;car;traffic:disabled',
}
response = requests.get(url, params=params)
result = response.json()
result
получите ответ сервера в виде хеша. //
об этом сказано в примечании:The result is always rounded towards minus infinity: 1//2 is 0, (-1)//2 is -1, 1//(-2) is -1, and (-1)//(-2) is 0.