hexo-blog-deploy/2021/04/28/python+faker生成以假乱真的数据/index.html

16 lines
109 KiB
HTML
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="zh-CN"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width"><meta name="theme-color" content="#222"><meta name="generator" content="Hexo 5.4.2"><link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png"><link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png"><link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png"><link rel="mask-icon" href="/images/logo.svg" color="#222"><link rel="stylesheet" href="/css/main.css"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" integrity="sha256-HtsXJanqjKTc8vVQjO4YMhiqFoXkfBsjBWcX91T1jr8=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.css" integrity="sha256-Vzbj7sDDS/woiFS3uNKo8eIuni59rjyNGtXfstRzStA=" crossorigin="anonymous"><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/themes/blue/pace-theme-minimal.css"><script src="https://cdnjs.cloudflare.com/ajax/libs/pace/1.2.4/pace.min.js" integrity="sha256-gqd7YTjg/BtfqWSwsJOvndl0Bxc8gFImLEkXQT8+qj0=" crossorigin="anonymous"></script><script class="next-config" data-name="main" type="application/json">{"hostname":"kiki.kim","root":"/","images":"/images","scheme":"Gemini","darkmode":false,"version":"8.15.1","exturl":false,"sidebar":{"position":"left","display":"post","padding":18,"offset":12},"copycode":{"enable":true,"style":"flat"},"bookmark":{"enable":false,"color":"#222","save":"auto"},"mediumzoom":false,"lazyload":false,"pangu":false,"comments":{"style":"tabs","active":null,"storage":true,"lazyload":false,"nav":null},"stickytabs":false,"motion":{"enable":false,"async":false,"transition":{"menu_item":"fadeInDown","post_block":"fadeIn","post_header":"fadeInDown","post_body":"fadeInDown","coll_header":"fadeInLeft","sidebar":"fadeInUp"}},"prism":false,"i18n":{"placeholder":"搜索...","empty":"没有找到任何搜索结果:${query}","hits_time":"找到 ${hits} 个搜索结果(用时 ${time} 毫秒)","hits":"找到 ${hits} 个搜索结果"},"path":"/search.xml","localsearch":{"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false}}</script><script src="/js/config.js"></script><meta name="description" content="用faker来生成各种各样的伪数据。"><meta property="og:type" content="article"><meta property="og:title" content="python+faker生成以假乱真的数据"><meta property="og:url" content="http://kiki.kim/2021/04/28/python+faker%E7%94%9F%E6%88%90%E4%BB%A5%E5%81%87%E4%B9%B1%E7%9C%9F%E7%9A%84%E6%95%B0%E6%8D%AE/index.html"><meta property="og:site_name" content="随言碎语"><meta property="og:description" content="用faker来生成各种各样的伪数据。"><meta property="og:locale" content="zh_CN"><meta property="article:published_time" content="2021-04-28T08:29:30.000Z"><meta property="article:modified_time" content="2023-05-11T05:19:02.507Z"><meta property="article:author" content="小梦同学"><meta property="article:tag" content="python"><meta property="article:tag" content="自动化测试"><meta property="article:tag" content="测试"><meta property="article:tag" content="faker"><meta name="twitter:card" content="summary"><link rel="canonical" href="http://kiki.kim/2021/04/28/python+faker%E7%94%9F%E6%88%90%E4%BB%A5%E5%81%87%E4%B9%B1%E7%9C%9F%E7%9A%84%E6%95%B0%E6%8D%AE/"><script class="next-config" data-name="page" type="application/json">{"sidebar":"","isHome":false,"isPost":true,"lang":"zh-CN","comments":true,"permalink":"http://kiki.kim/2021/04/28/python+faker%E7%94%9F%E6%88%90%E4%BB%A5%E5%81%87%E4%B9%B1%E7%9C%9F%E7%9A%84%E6%95%B0%E6%8D%AE/","path":"2021/04/28/python+faker生成以假乱真的数据/","title":"python+faker生成以假乱真的数据"}</script><script class="next-config" data-name="calendar" type="application/json">""</script><title>python+faker生成以假乱真的数据 | 随言碎语</title><noscript><link rel="stylesheet" href="/css/noscript.css"></noscript><link rel="alternate" href="/atom.xml" title="随言碎语" type="application/atom+xml"><style>.darkmode--activated{--body-bg-color:#282828;--content-bg-color:#333;--card-bg-color:#555;--text-color:#ccc;--blockquote-color:#bbb;--link-color:#ccc;--link-hover-color:#eee;--brand-color:#ddd;--brand-hover-color:#ddd;--table-row-odd-bg-color:#282828;--table-row-hover-bg-color:#363636;--menu-item-bg-color:#555;--btn-default-bg:#222;--btn-default-color:#ccc;--btn-default-border-color:#555;--btn-default-hover-bg:#666;--btn-default-hover-color:#ccc;--btn-default-hover-border-color:#666;--highlight-background:#282b2e;--highlight-foreground:#a9b7c6;--highlight-gutter-background:#34393d;--highlight-gutter-foreground:#9ca9b6}.darkmode--activated img{opacity:.75}.darkmode--activated img:hover{opacity:.9}.darkmode--activated code{color:#69dbdc;background:0 0}button.darkmode-toggle{z-index:9999}.darkmode-ignore,img{display:flex!important}.beian img{display:inline-block!important}</style></head><body itemscope itemtype="http://schema.org/WebPage"><div class="headband"></div><main class="main"><div class="column"><header class="header" itemscope itemtype="http://schema.org/WPHeader"><div class="site-brand-container"><div class="site-nav-toggle"><div class="toggle" aria-label="切换导航栏" role="button"><span class="toggle-line"></span> <span class="toggle-line"></span> <span class="toggle-line"></span></div></div><div class="site-meta"><a href="/" class="brand" rel="start"><i class="logo-line"></i><p class="site-title">随言碎语</p><i class="logo-line"></i></a><p class="site-subtitle" itemprop="description">咕叽咕叽</p></div><div class="site-nav-right"><div class="toggle popup-trigger" aria-label="搜索" role="button"><i class="fa fa-search fa-fw fa-lg"></i></div></div></div><nav class="site-nav"><ul class="main-menu menu"><li class="menu-item menu-item-home"><a href="/" rel="section"><i class="fa fa-home fa-fw"></i>首页</a></li><li class="menu-item menu-item-tags"><a href="/tags/" rel="section"><i class="fa fa-tags fa-fw"></i>标签<span class="badge">63</span></a></li><li class="menu-item menu-item-archives"><a href="/archives/" rel="section"><i class="fa fa-archive fa-fw"></i>归档<span class="badge">56</span></a></li><li class="menu-item menu-item-talk"><a href="/talk/" rel="section"><i class="fa fa-commenting fa-fw"></i>碎语湖</a></li><li class="menu-item menu-item-about"><a href="/about/" rel="section"><i class="fa fa-user fa-fw"></i>关于</a></li><li class="menu-item menu-item-search"><a role="button" class="popup-trigger"><i class="fa fa-search fa-fw"></i>搜索</a></li></ul></nav><div class="search-pop-overlay"><div class="popup search-popup"><div class="search-header"><span class="search-icon"><i class="fa fa-search"></i></span><div class="search-input-container"><input autocomplete="off" autocapitalize="off" maxlength="80" placeholder="搜索..." spellcheck="false" type="search" class="search-input"></div><span class="popup-btn-close" role="button"><i class="fa fa-times-circle"></i></span></div><div class="search-result-container no-result"><div class="search-result-icon"><i class="fa fa-spinner fa-pulse fa-5x"></i></div></div></div></div><script type="text/javascript" src="/js/cursor/zjAdd.js"></script><div class="musicwyy2" style="top:200px;position:fixed;left:0;bottom:0;z-index:105;opacity:1;width:45px;height:45px;font-size:45px;font-family:'Long Cang'"><button type="button" style="top:200px;width:45px;height:45px;margin-top:10px;margin-bottom:10px;border-width:0;z-index:200;background:0 0;border-width:0;outline:0" onclick="musicChange()"><img src="/images/wy.svg"></button></div><div class="musicwyy1" style="position:fixed;top:200px;left:0;bottom:0;z-index:100;opacity:1;width:45px;height:45px;font-size:0"><div class="aplayer-miniswitcher" style="top:200px;height:110px;width:20px;display:inline-block;overflow:hidden"></div><div style="width:calc(100% - 30px);top:200px;height:110px;display:none" id="musicZJ"><div class="musicwyy1" style="position:fixed;top:200px;left:15px;bottom:0;z-index:100;opacity:1;width:300px;height:110px;font-size:0"><div class="aplayer-miniswitcher" style="top:200px;height:110px;width:20px;display:inline-block;overflow:hidden"></div><div style="width:calc(100% - 30px);top:200px;height:110px;display:inline-block" id="musicZJ"><iframe frameborder="no" border="0" marginwidth="0" marginheight="0" width="330" height="450" src="//music.163.com/outchain/player?type=0&id=8009036598&auto=0&height=430"></iframe></div></div></div></div></header><aside class="sidebar"><div class="sidebar-inner sidebar-nav-active sidebar-toc-active"><ul class="sidebar-nav"><li class="sidebar-nav-toc">文章目录</li><li class="sidebar-nav-overview">站点概览</li></ul><div class="sidebar-panel-container"><div class="post-toc-wrap sidebar-panel"><div class="post-toc animated"><ol class="nav"><li class="nav-item nav-level-2"><a class="nav-link" href="#1-%E8%83%8C%E6%99%AF"><span class="nav-number">1.</span> <span class="nav-text">1. 背景</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-%E5%AE%89%E8%A3%85%E4%BD%BF%E7%94%A8"><span class="nav-number">2.</span> <span class="nav-text">2.安装使用</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-1-%E5%AE%89%E8%A3%85"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 安装</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 基本用法</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-3-%E4%BA%BA%E7%89%A9%E7%9B%B8%E5%85%B3"><span class="nav-number">2.3.</span> <span class="nav-text">2.3 人物相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-4-%E7%94%B5%E8%AF%9D%E7%9B%B8%E5%85%B3"><span class="nav-number">2.4.</span> <span class="nav-text">2.4 电话相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-5-%E6%A1%A3%E6%A1%88%E7%9B%B8%E5%85%B3"><span class="nav-number">2.5.</span> <span class="nav-text">2.5 档案相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-6-%E5%9C%B0%E7%90%86%E4%BF%A1%E6%81%AF%E7%B1%BB"><span class="nav-number">2.6.</span> <span class="nav-text">2.6 地理信息类</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-7-%E5%85%AC%E5%8F%B8%E7%9B%B8%E5%85%B3"><span class="nav-number">2.7.</span> <span class="nav-text">2.7 公司相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-8-%E6%97%B6%E9%97%B4%E7%9B%B8%E5%85%B3"><span class="nav-number">2.8.</span> <span class="nav-text">2.8 时间相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-9-%E6%96%87%E4%BB%B6%E7%9B%B8%E5%85%B3"><span class="nav-number">2.9.</span> <span class="nav-text">2.9 文件相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-10-%E5%9D%90%E6%A0%87%E7%9B%B8%E5%85%B3"><span class="nav-number">2.10.</span> <span class="nav-text">2.10 坐标相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-11-%E7%BD%91%E7%BB%9C%E7%9B%B8%E5%85%B3"><span class="nav-number">2.11.</span> <span class="nav-text">2.11 网络相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-12-%E4%BF%A1%E7%94%A8%E5%8D%A1%E7%9B%B8%E5%85%B3"><span class="nav-number">2.12.</span> <span class="nav-text">2.12 信用卡相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-13-%E9%A2%9C%E8%89%B2%E7%9B%B8%E5%85%B3"><span class="nav-number">2.13.</span> <span class="nav-text">2.13 颜色相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-14%E6%B5%8F%E8%A7%88%E5%99%A8%E4%BF%A1%E6%81%AF%E7%B1%BB"><span class="nav-number">2.14.</span> <span class="nav-text">2.14浏览器信息类</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-15%E6%96%87%E6%9C%AC%E7%9B%B8%E5%85%B3"><span class="nav-number">2.15.</span> <span class="nav-text">2.15文本相关</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-16%E7%94%A8%E6%88%B7%E4%BB%A3%E7%90%86%E7%9B%B8%E5%85%B3"><span class="nav-number">2.16.</span> <span class="nav-text">2.16用户代理相关</span></a></li></ol></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-%E8%84%9A%E6%9C%AC%E7%A4%BA%E4%BE%8B"><span class="nav-number">3.</span> <span class="nav-text">3. 脚本示例</span></a></li></ol></div></div><div class="site-overview-wrap sidebar-panel"><div class="site-author animated" itemprop="author" itemscope itemtype="http://schema.org/Person"><img class="site-author-image" itemprop="image" alt="小梦同学" src="https://halliday.oss-cn-nanjing.aliyuncs.com/imagesbjx.png"><p class="site-author-name" itemprop="name">小梦同学</p><div class="site-description" itemprop="description">欲买桂花同载酒,终不似,少年游。</div></div><div class="site-state-wrap animated"><nav class="site-state"><div class="site-state-item site-state-posts"><a href="/archives/"><span class="site-state-item-count">56</span> <span class="site-state-item-name">日志</span></a></div><div class="site-state-item site-state-tags"><a href="/tags/"><span class="site-state-item-count">63</span> <span class="site-state-item-name">标签</span></a></div></nav></div><div class="links-of-author animated"><span class="links-of-author-item"><a href="https://github.com/M-HALLIDAY" title="GitHub → https:&#x2F;&#x2F;github.com&#x2F;M-HALLIDAY" rel="noopener me" target="_blank"><i class="fab fa-github fa-fw"></i></a> </span><span class="links-of-author-item"><a href="mailto:halliday2023@163.com" title="E-Mail → mailto:halliday2023@163.com" rel="noopener me" target="_blank"><i class="fa fa-envelope fa-fw"></i></a> </span><span class="links-of-author-item"><a href="/atom.xml" title="RSS → &#x2F;atom.xml" rel="noopener me"><i class="fa fa-rss-square fa-fw"></i></a></span></div><div class="cc-license animated" itemprop="license"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-CN" class="cc-opacity" rel="noopener" target="_blank"><img src="https://cdnjs.cloudflare.com/ajax/libs/creativecommons-vocabulary/2020.11.3/assets/license_badges/small/by_nc_sa.svg" alt="Creative Commons"></a></div></div></div></div></aside></div><div class="main-inner post posts-expand"><div class="post-block"><article itemscope itemtype="http://schema.org/Article" class="post-content" lang="zh-CN"><link itemprop="mainEntityOfPage" href="http://kiki.kim/2021/04/28/python+faker%E7%94%9F%E6%88%90%E4%BB%A5%E5%81%87%E4%B9%B1%E7%9C%9F%E7%9A%84%E6%95%B0%E6%8D%AE/"><span hidden itemprop="author" itemscope itemtype="http://schema.org/Person"><meta itemprop="image" content="https://halliday.oss-cn-nanjing.aliyuncs.com/imagesbjx.png"><meta itemprop="name" content="小梦同学"></span><span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization"><meta itemprop="name" content="随言碎语"><meta itemprop="description" content="欲买桂花同载酒,终不似,少年游。"></span><span hidden itemprop="post" itemscope itemtype="http://schema.org/CreativeWork"><meta itemprop="name" content="python+faker生成以假乱真的数据 | 随言碎语"><meta itemprop="description" content=""></span><header class="post-header"><h1 class="post-title" itemprop="name headline">python+faker生成以假乱真的数据</h1><div class="post-meta-container"><div class="post-meta"><span class="post-meta-item"><span class="post-meta-item-icon"><i class="far fa-calendar"></i> </span><span class="post-meta-item-text">发表于</span> <time title="创建时间2021-04-28 16:29:30" itemprop="dateCreated datePublished" datetime="2021-04-28T16:29:30+08:00">2021-04-28</time> </span><span class="post-meta-item"><span class="post-meta-item-icon"><i class="far fa-calendar-check"></i> </span><span class="post-meta-item-text">更新于</span> <time title="修改时间2023-05-11 13:19:02" itemprop="dateModified" datetime="2023-05-11T13:19:02+08:00">2023-05-11</time> </span><span class="post-meta-item" title="阅读次数" id="busuanzi_container_page_pv"><span class="post-meta-item-icon"><i class="far fa-eye"></i> </span><span class="post-meta-item-text">阅读次数:</span> <span id="busuanzi_value_page_pv"></span> </span><span class="post-meta-break"></span> <span class="post-meta-item" title="本文字数"><span class="post-meta-item-icon"><i class="far fa-file-word"></i> </span><span class="post-meta-item-text">本文字数:</span> <span>17k</span> </span><span class="post-meta-item" title="阅读时长"><span class="post-meta-item-icon"><i class="far fa-clock"></i> </span><span class="post-meta-item-text">阅读时长 &asymp;</span> <span>30 分钟</span></span></div></div></header><div class="post-body" itemprop="articleBody"><p>用faker来生成各种各样的伪数据。</p><span id="more"></span><h2 id="1-背景">1. 背景</h2><p>软件测试中除了测试用例之外构造各种测试数据也测试人员需要花费时间去处理的。如果能够快速的造出比较真实、贴切业务实际、且数量可观的测试数据在一定程度上是可以加快测试人员的工作效率的。faker这个库便很好的解决了这个问题。</p><h2 id="2-安装使用">2.安装使用</h2><h3 id="2-1-安装">2.1 安装</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pip install faker</span><br></pre></td></tr></table></figure><h3 id="2-2-基本用法">2.2 基本用法</h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br></pre></td><td class="code"><pre><span class="line">from faker import Faker</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">初始化,指定地区,默认是美国</span></span><br><span class="line">fake = Faker(locale=&#x27;zh_CN&#x27;)</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">可选择的文化信息</span></span><br><span class="line">ar_EG - Arabic (Egypt)        阿拉伯语 - 埃及</span><br><span class="line"></span><br><span class="line">ar_PS - Arabic (Palestine)    阿拉伯语 - 巴勒斯坦</span><br><span class="line"></span><br><span class="line">ar_SA - Arabic (Saudi Arabia)    阿拉伯语 - 沙特阿拉伯</span><br><span class="line"></span><br><span class="line">bg_BG - Bulgarian        保加利亚语 - 保加利亚</span><br><span class="line"></span><br><span class="line">cs_CZ - Czech               捷克语 - 捷克</span><br><span class="line"></span><br><span class="line">de_DE - German            德语 - 德国</span><br><span class="line"></span><br><span class="line">dk_DK - Danish            丹麦语 - 丹麦</span><br><span class="line"></span><br><span class="line">el_GR - Greek            希腊语 - 希腊</span><br><span class="line"></span><br><span class="line">en_AU - English (Australia)    英语 - 澳大利亚</span><br><span class="line"></span><br><span class="line">en_CA - English (Canada)    英语 -  加拿大</span><br><span class="line"></span><br><span class="line">en_GB - English (Great Britain)    英语 - 英国</span><br><span class="line"></span><br><span class="line">en_US - English (United States)   英语 -  美国</span><br><span class="line"></span><br><span class="line">es_ES - Spanish (Spain)        西班牙语 - 西班牙</span><br><span class="line"></span><br><span class="line">es_MX - Spanish (Mexico)        西班牙语- 墨西哥</span><br><span class="line"></span><br><span class="line">et_EE - Estonian            爱沙尼亚语 - 爱沙尼亚</span><br><span class="line"></span><br><span class="line">fa_IR - Persian (Iran)        波斯语 - 伊朗</span><br><span class="line"></span><br><span class="line">fi_FI - Finnish        芬兰语 - 芬兰</span><br><span class="line"></span><br><span class="line">fr_FR - French         法语 - 法国</span><br><span class="line"></span><br><span class="line">hi_IN - Hindi            印地语 - 印度</span><br><span class="line"></span><br><span class="line">hr_HR - Croatian    克罗地亚语 - 克罗地亚</span><br><span class="line"></span><br><span class="line">hu_HU - Hungarian    匈牙利语 - 匈牙利</span><br><span class="line"></span><br><span class="line">hy_AM - Armenian 亚美尼亚语 - 亚美尼亚</span><br><span class="line"></span><br><span class="line">it_IT - Italian       意大利语 -  意大利</span><br><span class="line"></span><br><span class="line">ja_JP - Japanese    日语 - 日本</span><br><span class="line"></span><br><span class="line">ko_KR - Korean    朝鲜语 - 韩国</span><br><span class="line"></span><br><span class="line">ka_GE - Georgian (Georgia)  格鲁吉亚语 - 格鲁吉亚</span><br><span class="line"></span><br><span class="line">lt_LT - Lithuanian    立陶宛语 - 立陶宛</span><br><span class="line"></span><br><span class="line">lv_LV - Latvian    拉脱维亚语 - 拉脱维亚</span><br><span class="line"></span><br><span class="line">ne_NP - Nepali    尼泊尔语 - 尼泊尔</span><br><span class="line"></span><br><span class="line">nl_NL - Dutch (Netherlands)    德语 - 荷兰</span><br><span class="line"></span><br><span class="line">no_NO - Norwegian    挪威语 - 挪威</span><br><span class="line"></span><br><span class="line">pl_PL - Polish    波兰语 - 波兰</span><br><span class="line"></span><br><span class="line">pt_BR - Portuguese (Brazil)    葡萄牙语  - 巴西</span><br><span class="line"></span><br><span class="line">pt_PT - Portuguese (Portugal)    葡萄牙语 - 葡萄牙</span><br><span class="line"></span><br><span class="line">ru_RU - Russian    俄语 - 俄国</span><br><span class="line"></span><br><span class="line">sl_SI - Slovene   斯诺文尼亚语 - 斯诺文尼亚</span><br><span class="line"></span><br><span class="line">sv_SE - Swedish    瑞典语 - 瑞典 </span><br><span class="line"></span><br><span class="line">tr_TR - Turkish         土耳其语 - 土耳其</span><br><span class="line"></span><br><span class="line">uk_UA - Ukrainian    乌克兰语 - 乌克兰</span><br><span class="line"></span><br><span class="line">zh_CN - Chinese (China)    (简体中文)</span><br><span class="line"></span><br><span class="line">zh_TW - Chinese (Taiwan)  (繁体中文)</span><br><span class="line"></span><br></pre></td></tr></table></figure><h3 id="2-3-人物相关">2.3 <strong>人物相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">fake.name() # 姓名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;王凯&#x27;</span></span></span><br><span class="line"></span><br><span class="line"> fake.last_name() # 姓</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.address() # 地址 </span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">河北省辛集县合川张街p座 489476</span></span><br><span class="line"></span><br><span class="line">fake.job() # 职位</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;法务助理&#x27;</span></span></span><br><span class="line"></span><br><span class="line">fake.ssn() # 身份证</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;410622198603154708&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-4-电话相关">2.4 <strong>电话相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">fake.msisdn() # 完整手机号码(加了国家和国内区号)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;9067936325890&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.phone_number() # 手机号</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;18520149907&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.phonenumber_prefix() # 区号</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">145</span></span><br><span class="line"></span><br></pre></td></tr></table></figure><h3 id="2-5-档案相关">2.5 <strong>档案相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br></pre></td><td class="code"><pre><span class="line">fake.profile(fields=None, sex=None) # 档案(完整)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">&#123; <span class="string">&#x27;address&#x27;</span>: <span class="string">&#x27;河南省昆明市清河哈尔滨路H座 496152&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;birthdate&#x27;</span>: datetime.date(2014, 11, 20),</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;blood_group&#x27;</span>: <span class="string">&#x27;AB+&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;company&#x27;</span>: <span class="string">&#x27;易动力信息有限公司&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;current_location&#x27;</span>: (Decimal(<span class="string">&#x27;77.504143&#x27;</span>), Decimal(<span class="string">&#x27;-167.365806&#x27;</span>)),</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;job&#x27;</span>: <span class="string">&#x27;培训策划&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;mail&#x27;</span>: <span class="string">&#x27;liangyang@yahoo.com&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;name&#x27;</span>: <span class="string">&#x27;杨磊&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;residence&#x27;</span>: <span class="string">&#x27;澳门特别行政区台北县西夏兴城街L座 803680&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;sex&#x27;</span>: <span class="string">&#x27;F&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;ssn&#x27;</span>: <span class="string">&#x27;140722200004166520&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;username&#x27;</span>: <span class="string">&#x27;lei65&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;website&#x27;</span>: [ <span class="string">&#x27;http://www.29.cn/&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;http://www.lei.cn/&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;http://lishao.net/&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;https://www.feng.net/&#x27;</span>]&#125;</span></span><br><span class="line"> </span><br><span class="line">fake.simple_profile(sex=None) # 档案(简单)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">&#123; <span class="string">&#x27;address&#x27;</span>: <span class="string">&#x27;广西壮族自治区南宁市花溪孙街c座 653694&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;birthdate&#x27;</span>: datetime.date(1993, 12, 16),</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;mail&#x27;</span>: <span class="string">&#x27;haomin@yahoo.com&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;name&#x27;</span>: <span class="string">&#x27;任秀英&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;sex&#x27;</span>: <span class="string">&#x27;F&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;username&#x27;</span>: <span class="string">&#x27;iding&#x27;</span>&#125;</span></span><br></pre></td></tr></table></figure><h3 id="2-6-地理信息类">2.6 <strong>地理信息类</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br></pre></td><td class="code"><pre><span class="line">fake.address() # 地址</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;香港特别行政区大冶县上街钟街k座 664713&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.building_number() # 楼名 </span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;v座&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.city() # 完整城市名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;长春县&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.city_name() # 城市名字(不带市县)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;梧州&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.city_suffix() # 城市后缀名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.country() # 国家名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;厄立特里亚&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.country_code(representation=&quot;alpha-2&quot;)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;BZ&#x27;</span> <span class="comment"># 国家编号</span></span></span><br><span class="line"> </span><br><span class="line">fake.district() # 地区</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;沙湾&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.postcode() # 邮编</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;332991&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.province() # 省</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;河北省&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.street_address() # 街道地址</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;武汉街D座&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.street_name() # 街道名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;广州路&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.street_suffix() # 街道后缀名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;&#x27;</span></span></span><br><span class="line"></span><br></pre></td></tr></table></figure><h3 id="2-7-公司相关">2.7 <strong>公司相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line">fake.bs() # 商业用词</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;synthesize strategic vortals&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.catch_phrase() # 妙句(口号)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Robust even-keeled service-desk&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.company() # 公司名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;富罳科技有限公司&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.company_prefix() # 公司名称前缀</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;商软冠联&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.company_suffix() # 公司名称后缀</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;网络有限公司&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-8-时间相关">2.8 <strong>时间相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br></pre></td><td class="code"><pre><span class="line">fake.am_pm() # AM或PM</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;PM&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.century() # 世纪</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;XII&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.date(pattern=&quot;%Y-%m-%d&quot;, end_datetime=None) # 日期字符串(可设置格式和最大日期)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;1998-05-13&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.date_between(start_date=&quot;-30y&quot;, end_date=&quot;today&quot;) # 日期(可设置限定范围)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2014, 8, 17)</span></span><br><span class="line"> </span><br><span class="line">fake.date_between_dates(date_start=None, date_end=None) # 同上</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2019, 10, 14)</span></span><br><span class="line"> </span><br><span class="line">fake.date_object(end_datetime=None) # 日期(可设置最大日期)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(1981, 12, 20)</span></span><br><span class="line"> </span><br><span class="line">fake.date_of_birth(tzinfo=None, minimum_age=0, maximum_age=115) # 出生日期</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(1931, 12, 8)</span></span><br><span class="line"> </span><br><span class="line">fake.date_this_century(before_today=True, after_today=False) # 本世纪日期</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2003, 5, 4)</span></span><br><span class="line"> </span><br><span class="line">fake.date_this_decade(before_today=True, after_today=False) # 本年代中的日期</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2014, 1, 29)</span></span><br><span class="line"> </span><br><span class="line">fake.date_this_month(before_today=True, after_today=False) # 本月中的日期</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2019, 10, 10)</span></span><br><span class="line"> </span><br><span class="line">fake.date_this_year(before_today=True, after_today=False) # 本年中的日期</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2019, 3, 6)</span></span><br><span class="line"> </span><br><span class="line">fake.date_time(tzinfo=None, end_datetime=None) # 日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(1990, 8, 11, 22, 25)</span></span><br><span class="line"> </span><br><span class="line">fake.date_time_ad(tzinfo=None, end_datetime=None, start_datetime=None) # 日期和时间(从001年1月1日到现在)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(244, 12, 17, 9, 59, 56)</span></span><br><span class="line"> </span><br><span class="line">fake.date_time_between(start_date=&quot;-30y&quot;, end_date=&quot;now&quot;, tzinfo=None) # 日期时间(可设置限定范围)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(1995, 4, 19, 17, 23, 51)</span></span><br><span class="line"> </span><br><span class="line">fake.date_time_between_dates(datetime_start=None, datetime_end=None, tzinfo=None) # 同上</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(2019, 10, 14, 14, 15, 36)</span> </span><br><span class="line"> </span><br><span class="line">fake.date_time_this_century(before_now=True, after_now=False, tzinfo=None) # 本世纪中的日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(2009, 8, 26, 18, 27, 9)</span></span><br><span class="line"> </span><br><span class="line">fake.date_time_this_decade(before_now=True, after_now=False, tzinfo=None) # 本年代中的日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(2019, 2, 24, 22, 18, 44)</span></span><br><span class="line"> </span><br><span class="line">fake.date_time_this_month(before_now=True, after_now=False, tzinfo=None) # 本月中的日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(2019, 10, 3, 9, 20, 44)</span></span><br><span class="line"> </span><br><span class="line">fake.date_time_this_year(before_now=True, after_now=False, tzinfo=None) # 本年中的日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(2019, 2, 10, 7, 3, 18)</span></span><br><span class="line"> </span><br><span class="line">fake.day_of_month() # 几号</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;23&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.day_of_week() # 星期几</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Tuesday&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.future_date(end_date=&quot;+30d&quot;, tzinfo=None) # 未来日期</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2019, 10, 28)</span></span><br><span class="line"> </span><br><span class="line">fake.future_datetime(end_date=&quot;+30d&quot;, tzinfo=None) # 未来日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(2019, 10, 28, 21, 4, 35)</span></span><br><span class="line"> </span><br><span class="line">fake.iso8601(tzinfo=None, end_datetime=None) # iso8601格式日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;1995-04-10T00:45:01&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.month() # 第几月</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;07&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.month_name() # 月份名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;December&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.past_date(start_date=&quot;-30d&quot;, tzinfo=None) # 过去日期</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.date(2019, 10, 3)</span></span><br><span class="line"> </span><br><span class="line">fake.past_datetime(start_date=&quot;-30d&quot;, tzinfo=None) # 过去日期和时间</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.datetime(2019, 9, 30, 20, 25, 43)</span></span><br><span class="line"> </span><br><span class="line">fake.time(pattern=&quot;%H:%M:%S&quot;, end_datetime=None) # 时间(可设置格式和最大日期时间)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;14:26:44&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.time_delta(end_datetime=None) # 时间间隔</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.timedelta(0)</span></span><br><span class="line"> </span><br><span class="line">fake.time_object(end_datetime=None) # 时间(可设置最大日期时间)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">datetime.time(4, 41, 39)</span></span><br><span class="line"> </span><br><span class="line">fake.time_series(start_date=&quot;-30d&quot;, end_date=&quot;now&quot;, precision=None, distrib=None, tzinfo=None)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">&lt;generator object Provider.time_series at 0x7fadf51e0930&gt;</span></span><br><span class="line"> </span><br><span class="line">fake.timezone() # 时区</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Asia/Baku&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.unix_time(end_datetime=None, start_datetime=None) # UNIX时间戳</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">393980728</span></span><br><span class="line"> </span><br><span class="line">fake.year() # 某年</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;2016&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-9-文件相关">2.9 <strong>文件相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">fake.file_extension(category=None) # 文件扩展名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;avi&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.file_name(category=None, extension=None) # 文件名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;专业.pptx&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.file_path(depth=1, category=None, extension=None) # 文件路径</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;/的话/以上.ods&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.mime_type(category=None) # MIME类型</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;application/xop+xml&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.unix_device(prefix=None) # UNIX设备</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;/dev/xvdq&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.unix_partition(prefix=None) # UNIX分区</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;/dev/xvdc6&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-10-坐标相关">2.10 <strong>坐标相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">fake.coordinate(center=None, radius=0.001) # 坐标</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Decimal(<span class="string">&#x27;147.543284&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.latitude() # 纬度</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Decimal(<span class="string">&#x27;66.519139&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.latlng() # 经纬度</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(Decimal(<span class="string">&#x27;55.3370965&#x27;</span>), Decimal(<span class="string">&#x27;-15.427896&#x27;</span>))</span></span><br><span class="line"> </span><br><span class="line">fake.local_latlng(country_code=&quot;US&quot;, coords_only=False) # 返回某个国家某地的经纬度</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;25.67927&#x27;</span>, <span class="string">&#x27;-80.31727&#x27;</span>, <span class="string">&#x27;Kendall&#x27;</span>, <span class="string">&#x27;US&#x27;</span>, <span class="string">&#x27;America/New_York&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.location_on_land(coords_only=False) # 返回地球上某个位置的经纬度</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;42.50729&#x27;</span>, <span class="string">&#x27;1.53414&#x27;</span>, <span class="string">&#x27;les Escaldes&#x27;</span>, <span class="string">&#x27;AD&#x27;</span>, <span class="string">&#x27;Europe/Andorra&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.longitude() # 经度</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Decimal(<span class="string">&#x27;70.815233&#x27;</span>)</span></span><br></pre></td></tr></table></figure><h3 id="2-11-网络相关">2.11 <strong>网络相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br></pre></td><td class="code"><pre><span class="line">fake.ascii_company_email(*args, **kwargs) # 企业邮箱(ascii编码)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;qiuyan@xiulan.cn&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ascii_email(*args, **kwargs) # 企业邮箱+免费邮箱(ascii编码)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;lei59@78.net&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ascii_free_email(*args, **kwargs) # 免费邮箱(ascii编码)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;pcheng@gmail.com&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ascii_safe_email(*args, **kwargs) # 安全邮箱(ascii编码)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;fangyan@example.org&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.company_email(*args, **kwargs) # 企业邮箱</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;scao@pingjing.net&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.domain_name(levels=1) # 域名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;dy.cn&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.domain_word(*args, **kwargs) # 二级域名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;gangxiuying&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.email(*args, **kwargs) # 企业邮箱+免费邮箱</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;na13@ding.cn&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.free_email(*args, **kwargs) # 免费邮箱</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;fang48@hotmail.com&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.free_email_domain(*args, **kwargs) # 免费邮箱域名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;yahoo.com&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.hostname(*args, **kwargs) # 主机名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;lt-70.53.cn&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.image_url(width=None, height=None) # 图片URL</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;https://placekitten.com/752/243&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ipv4(network=False, address_class=None, private=None) # ipv4</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;160.152.149.78&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ipv4_network_class() # ipv4网络等级</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;b&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ipv4_private(network=False, address_class=None) # 私有ipv4</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;10.99.124.57&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ipv4_public(network=False, address_class=None) # 公共ipv4</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;169.120.29.235&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.ipv6(network=False) # ipv6</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;f392:573f:d60f:9aed:2a4c:36d7:fe5b:7034&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.mac_address() # MAC地址</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;62:67:79:8c:c2:40&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.safe_email(*args, **kwargs) # 安全邮箱</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;jing58@example.org&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.slug(*args, **kwargs) # URL中的slug</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.tld() # 顶级域名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;cn&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.uri() # URI</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;http://yi.com/list/main/explore/register.php&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.uri_extension() # URI扩展</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;.php&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.uri_page() # URI页</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;terms&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.uri_path(deep=None) # URI路径</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;blog/tags/blog&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.url(schemes=None) # URL</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;http://liutao.cn/&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.user_name(*args, **kwargs) # 用户名</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;xiulan80&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-12-信用卡相关">2.12 <strong>信用卡相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">fake.cryptocurrency() # 加密货币代码+名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;TRX&#x27;</span>, <span class="string">&#x27;TRON&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.cryptocurrency_code() # 加密货币代码</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;MZC&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.cryptocurrency_name() # 加密货币名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Ripple&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.currency() # 货币代码+名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;GNF&#x27;</span>, <span class="string">&#x27;Guinean franc&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.currency_code() # 货币代码</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;SOS&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.currency_name() # 货币名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Lebanese pound&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-13-颜色相关">2.13 <strong>颜色相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line">fake.color_name() # 颜色名称</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Orange&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.hex_color() # 颜色十六进制值</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;#a5cb7c&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.rgb_color() # 颜色RGB值</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;15,245,42&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.rgb_css_color() # CSS颜色值</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;rgb(15,70,13)&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.safe_color_name() # 安全色</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;aqua&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.safe_hex_color() # 安全色十六进制值</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;#881100&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-14浏览器信息类">2.14<strong>浏览器信息类</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br></pre></td><td class="code"><pre><span class="line">fake.mac_platform_token()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Macintosh; Intel Mac OS X 10_12_1&#x27;</span></span></span><br><span class="line"></span><br><span class="line">fake.firefox()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_9_4; rv:1.9.4.20) &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;Gecko/2012-05-03 04:16:34 Firefox/3.6.10&#x27;</span>)</span></span><br><span class="line"></span><br><span class="line">fake.windows_platform_token()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Windows 95&#x27;</span></span></span><br><span class="line"></span><br><span class="line">fake.safari()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;Mozilla/5.0 (iPod; U; CPU iPhone OS 3_1 like Mac OS X; sat-IN) &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;AppleWebKit/533.2.4 (KHTML, like Gecko) Version/3.0.5 Mobile/8B113 &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;Safari/6533.2.4&#x27;</span>)</span></span><br><span class="line"></span><br><span class="line">fake.chrome(version_from=13, version_to=63, build_from=800, build_to=899)</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/5331 (KHTML, like Gecko) &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;Chrome/52.0.838.0 Safari/5331&#x27;</span>)</span></span><br><span class="line"></span><br><span class="line">fake.opera()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Opera/8.83.(X11; Linux i686; ce-RU) Presto/2.9.169 Version/10.00&#x27;</span></span></span><br><span class="line"></span><br><span class="line">fake.mac_processor()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Intel&#x27;</span></span></span><br><span class="line"></span><br><span class="line">fake.user_agent()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_9 rv:3.0; pa-IN) &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;AppleWebKit/532.47.6 (KHTML, like Gecko) Version/4.0.1 Safari/532.47.6&#x27;</span>)</span></span><br><span class="line"></span><br><span class="line">fake.linux_platform_token()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;X11; Linux x86_64&#x27;</span></span></span><br><span class="line"></span><br><span class="line">fake.linux_processor()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;i686&#x27;</span></span></span><br><span class="line"></span><br><span class="line">fake.internet_explorer()</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Mozilla/5.0 (compatible; MSIE 5.0; Windows NT 5.01; Trident/3.1)&#x27;</span></span></span><br></pre></td></tr></table></figure><h3 id="2-15文本相关">2.15<strong>文本相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br></pre></td><td class="code"><pre><span class="line">fake.paragraph(nb_sentences=3, variable_nb_sentences=True, ext_word_list=None) # 单个段落</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;最新事情生产.方面解决名称责任而且.类型其实内容发生电脑.音乐具有今年是一.&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.paragraphs(nb=3, ext_word_list=None) # 多个段落 </span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">[<span class="string">&#x27;使用评论管理.没有广告工作评论是否.&#x27;</span>, <span class="string">&#x27;帖子而且专业.这些比较完全发现准备设计工具.&#x27;</span>, <span class="string">&#x27;完成详细发生空间汽车.新闻电影您的游戏这种操作网站知道.&#x27;</span>]</span></span><br><span class="line"> </span><br><span class="line">fake.sentence(nb_words=6, variable_nb_words=True, ext_word_list=None) # 单个句子</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;直接这样点击单位对于时候.&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.sentences(nb=3, ext_word_list=None) # 多个句子</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">[<span class="string">&#x27;电话国际项目管理.&#x27;</span>, <span class="string">&#x27;软件之后提高一样次数电影规定.&#x27;</span>, <span class="string">&#x27;东西会员发展什么不断经济.&#x27;</span>]</span></span><br><span class="line"> </span><br><span class="line">fake.text(max_nb_chars=200, ext_word_list=None) # 单个文本</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;资源信息得到因此开发资源资料.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;国家这样等级需要用户如此.电话非常一切游戏所以学校类型.不要正在如果来源认为投资在线.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;这些更新密码其中起来实现有些.以上事情重要通过.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;但是就是介绍最大深圳简介设计.历史这种可以出现中心社区.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;政府当然包括简介全国内容生活.有些地址以上.回复这些来自搜索现在不断经营不断.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;操作为什孩子报告东西拥有如此.相关特别业务日本这种.合作问题准备比较谢谢.&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.texts(nb_texts=3, max_nb_chars=200, ext_word_list=None) # 多个文本</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">[ <span class="string">&#x27;地址控制无法正在必须中心积分一些.支持制作安全.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;比较最新最大她的功能能够是一.主题选择当前显示.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;的话社会现在地区阅读继续所有.美国数据正在深圳不能.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;能够查看其中生活商品.谢谢认为之后以及以下之后这里.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;活动支持人民这么今年.要求包括生活运行技术社会.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;当前更多游戏.下载一点开发论坛法律为了美国.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;如何更新个人谢谢作为还有论坛.销售销售法律学生这么责任一些.&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;日本最大方法活动主题到了结果.教育还有孩子觉得简介出现国际.东西国家图片威望品牌.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;那些会员现在准备可能.威望部分文件主题东西业务一切之间.所以必须当前方法.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;等级大小重要可能下载孩子.来源感觉业务文件以后深圳学校.网络什么新闻都是安全.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;资料重要成功谢谢时候音乐安全相关.电脑系列日期.工具使用搜索来源首页.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;直接企业影响大小什么.相关品牌选择她的规定来源推荐.&#x27;</span>,</span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;中文文化数据内容系统.他们这些之间深圳.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;联系城市出现部分都是政府生活.社会同时人民市场现在决定需要.其他政府简介深圳教育加入对于.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;运行是一语言安全通过大小学生.商品然后信息由于虽然.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;因为关于选择希望行业具有深圳.出现价格那么下载提高知道人员.设备直接显示事情帖子正在两个关于.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;系列公司大家.论坛所以完全文章标准.活动中国工具电脑.\n&#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;主题作者不能.进行国家系统地区增加.经验质量价格我的.&#x27;</span>]</span></span><br><span class="line"> </span><br><span class="line">fake.word(ext_word_list=None) # 单个词语</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;新闻&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.words(nb=3, ext_word_list=None, unique=False) # 多个词语</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">[<span class="string">&#x27;选择&#x27;</span>, <span class="string">&#x27;历史&#x27;</span>, <span class="string">&#x27;规定&#x27;</span>]</span></span><br></pre></td></tr></table></figure><h3 id="2-16用户代理相关">2.16<strong>用户代理相关</strong></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br></pre></td><td class="code"><pre><span class="line">fake.android_platform_token() # 安卓</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Android 5.0.1&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.chrome(version_from=13, version_to=63, build_from=800, build_to=899) # Chrome</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_10_9) AppleWebKit/534.0 (KHTML, &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;like Gecko) Chrome/62.0.826.0 Safari/534.0&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.firefox() # FireFox</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;Mozilla/5.0 (Windows NT 5.1; cs-CZ; rv:1.9.0.20) Gecko/2010-12-02 06:14:30 &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;Firefox/3.6.5&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.internet_explorer() # Ie</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Mozilla/5.0 (compatible; MSIE 7.0; Windows 95; Trident/3.0)&#x27;</span></span> </span><br><span class="line"> </span><br><span class="line">fake.ios_platform_token() # ios</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;iPhone; CPU iPhone OS 5_1_1 like Mac OS X&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.linux_platform_token() # Linux</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;X11; Linux i686&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.linux_processor() # Linux处理器</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;x86_64&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.mac_platform_token() # Mac</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Macintosh; U; PPC Mac OS X 10_11_2&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.mac_processor() # Mac处理器</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Intel&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.opera() # Opera</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Opera/8.32.(Windows 98; Win 9x 4.90; mr-IN) Presto/2.9.188 Version/10.00&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.safari() # Safari</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">(<span class="string">&#x27;Mozilla/5.0 (Windows; U; Windows NT 6.0) AppleWebKit/533.43.6 (KHTML, like &#x27;</span></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"> <span class="string">&#x27;Gecko) Version/4.0.5 Safari/533.43.6&#x27;</span>)</span></span><br><span class="line"> </span><br><span class="line">fake.user_agent() # 随机用户代理</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Mozilla/5.0 (compatible; MSIE 9.0; Windows 95; Trident/3.0)&#x27;</span></span></span><br><span class="line"> </span><br><span class="line">fake.windows_platform_token() # Windows</span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash"><span class="string">&#x27;Windows NT 6.2&#x27;</span></span></span><br></pre></td></tr></table></figure><h2 id="3-脚本示例">3. 脚本示例</h2><p>faker_demo.py</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_">#</span><span class="language-bash">encoding=utf-8</span></span><br><span class="line">import csv</span><br><span class="line">from faker import Faker</span><br><span class="line"></span><br><span class="line">&quot;&quot;&quot;</span><br><span class="line">生成尽可能真实的假数据</span><br><span class="line"></span><br><span class="line">使用方法:</span><br><span class="line">1.安装依赖包</span><br><span class="line"> pip install faker</span><br><span class="line">2.执行脚本</span><br><span class="line"> python faker_demo.py</span><br><span class="line">3.当前目录,查看生成的数据</span><br><span class="line">&quot;&quot;&quot;</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">保存为csv文件</span></span><br><span class="line">def save_data_csv(file_name):</span><br><span class="line"> #获取数据</span><br><span class="line"> datas = faker_data()</span><br><span class="line"> #保存</span><br><span class="line"> with open(file_name,&#x27;w+&#x27;,encoding=&#x27;utf-8&#x27;,newline=&#x27;&#x27;) as file_csv:</span><br><span class="line"> writer = csv.writer(file_csv, delimiter=&#x27;,&#x27;, quotechar=&#x27;&quot;&#x27;, quoting=csv.QUOTE_ALL)</span><br><span class="line"> writer.writerows(datas)</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_">#</span><span class="language-bash">生成数据</span></span><br><span class="line">def faker_data():</span><br><span class="line"> #指定数据的国家地区</span><br><span class="line"> f = Faker(&#x27;zh-CN&#x27;)</span><br><span class="line"> #定义一个列表,用来存放所有数据</span><br><span class="line"> datas = []</span><br><span class="line"> #标题</span><br><span class="line"> title = [&quot;唯一标识&quot;,&quot;编号&quot;,&quot;姓名&quot;,&quot;手机号&quot;,&quot;身份证号&quot;,&quot;性别&quot;,&quot;邮箱&quot;,&quot;职业&quot;,&quot;家庭地址&quot;,&quot;获取时间&quot;]</span><br><span class="line"> #添加标题到列表中</span><br><span class="line"> datas.append(title)</span><br><span class="line"> #开始按照标题的顺序生成200条数据</span><br><span class="line"> for i in range(0,200):</span><br><span class="line"> #定义一个列表,用来存一行数据</span><br><span class="line"> data = []</span><br><span class="line"> #uuid</span><br><span class="line"> data.append(f.uuid4())</span><br><span class="line"> #编号001不足3位的左边用0来补齐</span><br><span class="line"> data.append(str(i+1).rjust(3,&#x27;0&#x27;))</span><br><span class="line"> #姓名</span><br><span class="line"> data.append(f.name())</span><br><span class="line"> #手机号</span><br><span class="line"> data.append(f.phone_number())</span><br><span class="line"> #身份证</span><br><span class="line"> ssn = f.ssn()</span><br><span class="line"> data.append(ssn)</span><br><span class="line"> #性别根据身份证的第17位来判断</span><br><span class="line"> ssn_sex = int(ssn[16:17])</span><br><span class="line"> #0102</span><br><span class="line"> if ssn_sex % 2:</span><br><span class="line"> sex = &quot;01&quot;</span><br><span class="line"> else:</span><br><span class="line"> sex = &quot;02&quot;</span><br><span class="line"> data.append(sex)</span><br><span class="line"> #邮箱</span><br><span class="line"> data.append(f.email())</span><br><span class="line"> #职业</span><br><span class="line"> data.append(f.job())</span><br><span class="line"> #地址,让其更加复合中国的地址</span><br><span class="line"> address = f.address()[:-9] + str(f.pyint(min_value=0, max_value=999))+ &quot;&quot;</span><br><span class="line"> data.append(address)</span><br><span class="line"> #获取时间近3年的</span><br><span class="line"> actime_time = f.date_time_between(start_date=&quot;-3y&quot;, end_date=&quot;now&quot;)</span><br><span class="line"> data.append(actime_time)</span><br><span class="line"> #将这一行数据添加到datas中</span><br><span class="line"> datas.append(data)</span><br><span class="line"> #返回所有的数据</span><br><span class="line"> return datas</span><br><span class="line"> </span><br><span class="line"> </span><br><span class="line">if __name__ == &#x27;__main__&#x27;:</span><br><span class="line"> #文件名</span><br><span class="line"> file_name = &#x27;test.csv&#x27;</span><br><span class="line"> save_data_csv(file_name)</span><br><span class="line"></span><br></pre></td></tr></table></figure></div><footer class="post-footer"><div><div style="text-align:center;color:#ccc;font-size:24px;padding-top:10px">----- The End -----</div><div><center><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/css/share.min.css"><div class="social-share" data-sites="weibo, qq, qzone,wechat"></div><script src="http://apps.bdimg.com/libs/jquery/1.8.2/jquery.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/social-share.js/1.0.16/js/social-share.min.js"></script></center></div></div><div class="post-copyright"><ul><li class="post-copyright-author"><strong>本文作者: </strong>小梦同学</li><li class="post-copyright-link"><strong>本文链接:</strong> <a href="http://kiki.kim/2021/04/28/python+faker%E7%94%9F%E6%88%90%E4%BB%A5%E5%81%87%E4%B9%B1%E7%9C%9F%E7%9A%84%E6%95%B0%E6%8D%AE/" title="python+faker生成以假乱真的数据">http://kiki.kim/2021/04/28/python+faker生成以假乱真的数据/</a></li><li class="post-copyright-license"><strong>版权声明: </strong>本博客所有文章除特别声明外,均采用 <a href="https://creativecommons.org/licenses/by-nc-sa/4.0/zh-CN" rel="noopener" target="_blank"><i class="fab fa-fw fa-creative-commons"></i>BY-NC-SA</a> 许可协议。转载请注明出处!</li></ul></div><div class="post-tags"><a href="/tags/python/" rel="tag"><i class="fa fa-tag"></i> python</a> <a href="/tags/%E8%87%AA%E5%8A%A8%E5%8C%96%E6%B5%8B%E8%AF%95/" rel="tag"><i class="fa fa-tag"></i> 自动化测试</a> <a href="/tags/%E6%B5%8B%E8%AF%95/" rel="tag"><i class="fa fa-tag"></i> 测试</a> <a href="/tags/faker/" rel="tag"><i class="fa fa-tag"></i> faker</a></div><script type="text/javascript">for(var tagsall=document.getElementsByClassName("post-tags"),i=tagsall.length-1;0<=i;i--)for(var tags=tagsall[i].getElementsByTagName("a"),j=tags.length-1;0<=j;j--){var r,g,b,golden_ratio=.618033988749895,s=.5,v=.999,h=golden_ratio+.8*Math.random()-.5,h_i=parseInt(6*h),f=6*h-h_i,p=v*(1-s),q=v*(1-f*s),t=v*(1-(1-f)*s);switch(h_i){case 0:r=v,g=t,b=p;break;case 1:r=q,g=v,b=p;break;case 2:r=p,g=v,b=t;break;case 3:r=p,g=q,b=v;break;case 4:r=t,g=p,b=v;break;case 5:r=v,g=p,b=q;break;default:b=g=r=1}tags[j].style.background="rgba("+parseInt(255*r)+","+parseInt(255*g)+","+parseInt(255*b)+",0.5)"}</script><div class="post-nav"><div class="post-nav-item"><a href="/2021/04/19/%E4%BD%BF%E7%94%A8pipx%E6%9D%A5%E8%BF%90%E8%A1%8C%E7%8B%AC%E7%AB%8B%E7%9A%84python%E5%BA%94%E7%94%A8/" rel="prev" title="使用pipx来运行独立的python应用"><i class="fa fa-chevron-left"></i> 使用pipx来运行独立的python应用</a></div><div class="post-nav-item"><a href="/2021/05/13/python%E8%99%9A%E6%8B%9F%E7%8E%AF%E5%A2%83%E5%B7%A5%E5%85%B7pipenv%E7%9A%84%E4%BD%BF%E7%94%A8/" rel="next" title="python虚拟环境工具pipenv的使用">python虚拟环境工具pipenv的使用 <i class="fa fa-chevron-right"></i></a></div></div></footer></article></div></div></main><footer class="footer"><div class="footer-inner"><div class="copyright">&copy; <span itemprop="copyrightYear">2023</span> <span class="with-love"><i class="fa fa-heart"></i> </span><span class="author" itemprop="copyrightHolder">小梦同学</span></div><div class="beian"><img src="https://www.beian.gov.cn/img/new/gongan.png" alt=""><a href="https://www.beian.gov.cn//portal/registerSystemInfo?recordcode=%E7%94%B3%E8%AF%B7%E4%B8%AD" rel="noopener" target="_blank">申请中 </a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="https://beian.miit.gov.cn/" rel="noopener" target="_blank">苏ICP备2021047152号-1</a></div><div class="busuanzi-count"><span class="post-meta-item" id="busuanzi_container_site_uv"><span class="post-meta-item-icon"><i class="fa fa-user"></i> </span><span class="site-uv" title="总访客量"><span id="busuanzi_value_site_uv"></span> </span></span><span class="post-meta-item" id="busuanzi_container_site_pv"><span class="post-meta-item-icon"><i class="fa fa-eye"></i> </span><span class="site-pv" title="总访问量"><span id="busuanzi_value_site_pv"></span></span></span></div><div class="powered-by"><a href="https://hexo.io/" rel="noopener" target="_blank">Hexo</a> & <a href="https://theme-next.js.org/" rel="noopener" target="_blank">NexT.Gemini</a> 强力驱动</div><span id="timeDate">载入天数...</span> <span id="times">载入时分秒...</span><script>var now=new Date;function createtime(){var n=new Date("03/01/2023 10:00:00");now.setTime(now.getTime()+250),days=(now-n)/1e3/60/60/24,dnum=Math.floor(days),hours=(now-n)/1e3/60/60-24*dnum,hnum=Math.floor(hours),1==String(hnum).length&&(hnum="0"+hnum),minutes=(now-n)/1e3/60-1440*dnum-60*hnum,mnum=Math.floor(minutes),1==String(mnum).length&&(mnum="0"+mnum),seconds=(now-n)/1e3-86400*dnum-3600*hnum-60*mnum,snum=Math.round(seconds),1==String(snum).length&&(snum="0"+snum),document.getElementById("timeDate").innerHTML="本站已安全运行 "+dnum+" 天 ",document.getElementById("times").innerHTML=hnum+" 小时 "+mnum+" 分 "+snum+" 秒."}setInterval("createtime()",250)</script></div></footer><div class="back-to-top" role="button" aria-label="返回顶部"><i class="fa fa-arrow-up fa-lg"></i> <span>0%</span></div><div class="reading-progress-bar"></div><a href="https://github.com/M-HALLIDAY" class="github-corner" title="在 GitHub 上关注我" aria-label="在 GitHub 上关注我" rel="noopener" target="_blank"><svg width="80" height="80" viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin:130px 106px" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><noscript><div class="noscript-warning">Theme NexT works best with JavaScript enabled</div></noscript><script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.1/anime.min.js" integrity="sha256-XL2inqUJaslATFnHdJOi9GfQ60on8Wx1C2H8DYiN1xY=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.4/jquery.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/fancybox/3.5.7/jquery.fancybox.min.js" integrity="sha256-yt2kYMy0w8AbtF89WXb2P1rfjcP/HTHLT7097U8Y5b8=" crossorigin="anonymous"></script><script src="/js/comments.js"></script><script src="/js/utils.js"></script><script src="/js/next-boot.js"></script><script src="https://cdnjs.cloudflare.com/ajax/libs/hexo-generator-searchdb/1.4.1/search.js" integrity="sha256-1kfA5uHPf65M5cphT2dvymhkuyHPQp5A53EGZOnOLmc=" crossorigin="anonymous"></script><script src="/js/third-party/search/local-search.js"></script><script src="/js/third-party/fancybox.js"></script><script src="/js/third-party/pace.js"></script><script async src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><script src="https://unpkg.com/darkmode-js@1.5.7/lib/darkmode-js.min.js"></script><script>var options = {
bottom: '64px',
right: 'unset',
left: '32px',
time: '0.5s',
mixColor: 'transparent',
backgroundColor: 'transparent',
buttonColorDark: '#100f2c',
buttonColorLight: '#fff',
saveInCookies: true,
label: '🌓',
autoMatchOsTheme: true
}
const darkmode = new Darkmode(options);
window.darkmode = darkmode;
darkmode.showWidget();</script><script async src="/js/cursor/love.min.js"></script><script type="text/javascript" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script></body></html>