1. 如何获取属性相同的(金属,一米)的商品 [1-3]?
+----------+-----------+
| goods_id | attribute |
+----------+-----------+
| 1 | 红色 |
| 1 | 金属 |
| 2 | 绿色 |
| 2 | 金属 |
| 1 | 一米 |
| 2 | 一米 |
| 3 | 金属 |
| 3 | 一米 |
| 3 | 蓝色 |
| 4 | 木制 |
| 4 | 一米 |
| 4 | 黑色 |
+----------+-----------+
12 rows in set (0.00 sec )
2. php 的
<?php
$data = array (
'email' => 'i@xxx',
'password' => '000000',
'client' => '7781809591'
);
$json_data = json_encode ($data );
输出 {"email":"i@xxx","password":"000000","client":"7781809591"}
如何用 python 实现(要求输出一模一样,要拼接字符串,加密获取 token )
之前用 Dict , repr 之后,因为 dict 无序所以得出以下
{'password': '000000', 'email': 'i@xxx', 'client': '7781809591'}
试过 OrderedDict 输出
OrderedDict ([('password', '000000'), ('email', 'i@xxx'), ('client', '7781809591')])
达不到输出一模一样
麻烦大家指点下.谢谢
+----------+-----------+
| goods_id | attribute |
+----------+-----------+
| 1 | 红色 |
| 1 | 金属 |
| 2 | 绿色 |
| 2 | 金属 |
| 1 | 一米 |
| 2 | 一米 |
| 3 | 金属 |
| 3 | 一米 |
| 3 | 蓝色 |
| 4 | 木制 |
| 4 | 一米 |
| 4 | 黑色 |
+----------+-----------+
12 rows in set (0.00 sec )
2. php 的
<?php
$data = array (
'email' => 'i@xxx',
'password' => '000000',
'client' => '7781809591'
);
$json_data = json_encode ($data );
输出 {"email":"i@xxx","password":"000000","client":"7781809591"}
如何用 python 实现(要求输出一模一样,要拼接字符串,加密获取 token )
之前用 Dict , repr 之后,因为 dict 无序所以得出以下
{'password': '000000', 'email': 'i@xxx', 'client': '7781809591'}
试过 OrderedDict 输出
OrderedDict ([('password', '000000'), ('email', 'i@xxx'), ('client', '7781809591')])
达不到输出一模一样
麻烦大家指点下.谢谢