首先我们来看下我国的城市层次,除了港澳台外,中国一共有337个地级市(含4个直辖市)。,然后综合城市人口规模和城市经济的发展水平,将城市划分成一线、新一线、二线、三线、四线、五线等不同层次。

那我们重点来了解下城市人口规模,根据最新人口普查公开数据,中国337个地级市当中,一共有88个城市超过500万个。它们是哪些城市呢?有没有你所在的城市呢?今天我们用Python来了解下都是哪些城市吧。
数据来源:https://population.gotohui.com/
代理来源:https://www.16yun.cn/#banner
代码示例:
<?php
// 要访问的目标页面
$url = "https://population.gotohui.com/";
$urls = "https://population.gotohui.com/";
// 代理服务器(产品官网 www.16yun.cn)
define("PROXY_SERVER", "tcp://t.16yun.cn:31111");
// 代理身份信息
define("PROXY_USER", "16FEYIEB");
define("PROXY_PASS", "359725");
$proxyAuth = base64_encode(PROXY_USER . ":" . PROXY_PASS);
// 设置 Proxy tunnel
$tunnel = rand(1,10000);
$headers = implode("\r\n", [
"Proxy-Authorization: Basic {$proxyAuth}",
"Proxy-Tunnel: ${tunnel}",
]);
$sniServer = parse_url($urls, PHP_URL_HOST);
$options = [
"http" => [
"proxy" => PROXY_SERVER,
"header" => $headers,
"method" => "GET",
'request_fulluri' => true,
],
'ssl' => array(
'SNI_enabled' => true, // Disable SNI for https over http proxies
'SNI_server_name' => $sniServer
)
];
print($url);
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
var_dump($result);
// 访问 HTTPS 页面
print($urls);
$context = stream_context_create($options);
$result = file_get_contents($urls, false, $context);
var_dump($result);
?>
从获取到的数据可以看出来,这些人口超过500万的城市大部分都分布在南方。