国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計(jì) > 正文

利用ForgeryPy生成虛擬數(shù)據(jù)

2019-11-11 05:04:39
字體:
供稿:網(wǎng)友

在程序研發(fā)過程中,我們往往需要大量的虛擬實(shí)驗(yàn)數(shù)據(jù)。Python中有多個包可以用于生成虛擬數(shù)據(jù),其中功能較為完善的是ForgeryPy。

0x01 安裝

采用pip進(jìn)行安裝:

pip install ForgeryPy

0x02 模塊

打開源碼

# -*- coding: utf-8 -*-# Copyright (C) 2012 by Tomasz Wójcik <labs@tomekwojcik.pl>## Permission is hereby granted, free of charge, to any person obtaining a copy# of this software and associated documentation files (the "Software"), to deal# in the Software without restriction, including without limitation the rights# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell# copies of the Software, and to permit persons to whom the Software is# furnished to do so, subject to the following conditions:## The above copyright notice and this permission notice shall be included in# all copies or substantial portions of the Software.## THE SOFTWARE IS ForgeryPy包括了地理位置、日期、網(wǎng)絡(luò)、名稱等大量虛擬生成算法,非常方便我們用來生成虛擬數(shù)據(jù)。

0x03 例子

#coding:utf-8#導(dǎo)入模塊import forgery_py#地理信息(城市)city=forgery_py.address.city()print city#隨機(jī)顏色color=forgery_py.basic.hex_color()print color#時間data=forgery_py.date.date(True)print data#電子郵箱email=forgery_py.internet.email_address()print email#姓名name=forgery_py.name.full_name()print name#公司company=forgery_py.name.company_name()print company#簡介about=forgery_py.lorem_ipsum.sentence()print about

其中一次的運(yùn)行結(jié)果:

Paso Robles28E75D2017-01-18sandra@oloo.orgWayne KingZoomloungeMaecenas leo odio, condimentum id, luctus nec, molestie sed, justo.
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 镇江市| 康保县| 延寿县| 肇庆市| 香港 | 乌兰察布市| 南开区| 铜山县| 米易县| 文安县| 子洲县| 邹城市| 莒南县| 双峰县| 定襄县| 大埔县| 卓尼县| 昌乐县| 天全县| 固阳县| 湛江市| 西宁市| 台北县| 浦城县| 林州市| 南安市| 保康县| 宜阳县| 竹山县| 乐安县| 呼伦贝尔市| 莆田市| 盘山县| 绥江县| 喀喇沁旗| 菏泽市| 韶关市| 乌兰县| 肃南| 晋州市| 唐海县|