__iadd__
- сложение с присваиванием. Например, x += 42
__radd__
- отражённое сложение. Например, 42 + x
Closing a socket doesn't clear its connection state, which means this method will return true for a closed socket (see isClosed()) if it was successfuly connected prior to being closed.
def show_table(request):
order_by = request.GET.get('orderby', settings.DEFAULT_ORDER)
some_data = SomeModel.objects.order_by(order_by)
return render(request, 'some_template.hmtl', {'rows': some_data})
<form>
<select name="orderby">
<option value="name">Наименование</option>
<option value="price">Цена</option>
<option value="quantity">Количество</option>
</select>
<input type="sumbit" value="Отсортировать">
</form>
<table>
<tr>
<th>Наименование</th>
<th>Цена</th>
<th>Количество</th>
</tr>
{% for row in rows %}
<tr>
<td>{{ row.name }}</td>
<td>{{ row.price }}</td>
<td>{{ row.quantity }}</td>
</tr>
{% endfor %}
</table>
try (BufferedReader br = new BufferedReader(new FileReader("test.txt"))) {
String line;
while ((line = br.readLine()) != null) {
if (line.startsWith("count:")) {
String[] parts = line.split(" ");
if (parts.length > 1) {
int count = Integer.valueOf(parts[1]);
System.out.println("count: " + ++count);
}
}
else {
System.out.println(line);
}
}
}
catch (IOException exc) {
exc.printStackTrace();
}