zoukankan      html  css  js  c++  java
  • Python-faker的函数效果一览

    Python-faker的函数效果一览

    tags faker 随机 虚拟

    faker文档链接

    代码程序:

    # -*- coding=utf-8 -*-
    import sys
    from faker import Factory
    reload(sys)
    sys.setdefaultencoding('utf8')
    
    fake = Factory().create('zh_CN')
    li =  dir(fake)
    def get_dir_run():
        with open('somefile.txt', 'wt') as f:
            for i in li:
                a = None
                try:
                    cmd = "fake."+i+"()"
                    a = eval(cmd)
                    print cmd
                except Exception:
                    a = None
                if a:
                    message = "{0}   # {1} 
    ".format(cmd,a)
                    f.write(message)
    get_dir_run()

    函数样例:

    fake.__class__()   # <faker.generator.Generator object at 0x7ff780c23e10> 
    fake.__hash__()   # 8793824177497 
    fake.__repr__()   # <faker.generator.Generator object at 0x7ff78c42d590> 
    fake.__sizeof__()   # 32 
    fake.__str__()   # <faker.generator.Generator object at 0x7ff78c42d590> 
    fake.__subclasshook__()   # NotImplemented 
    fake.address()   # 云南省荣县白云延路y座 648847 
    fake.am_pm()   # AM 
    fake.ascii_company_email()   # zhangchao@mao.com 
    fake.ascii_email()   # yongzheng@hotmail.com 
    fake.ascii_free_email()   # gongfang@hotmail.com 
    fake.ascii_safe_email()   # tzhao@example.net 
    fake.boolean()   # True 
    fake.bothify()   # 10 Nq 
    fake.bs()   # productize front-end supply-chains 
    fake.building_number()   # E座 
    fake.catch_phrase()   # Visionary logistical initiative 
    fake.century()   # II 
    fake.chrome()   # Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_9) AppleWebKit/5352 (KHTML, like Gecko) Chrome/14.0.828.0 Safari/5352 
    fake.city()   # 成都市 
    fake.city_name()   # 宁德 
    fake.city_suffix()   # 市 
    fake.color_name()   # DarkOliveGreen 
    fake.company()   # 网新恒天信息有限公司 
    fake.company_email()   # xiongchao@cai.com 
    fake.company_prefix()   # 维旺明 
    fake.company_suffix()   # 信息有限公司 
    fake.country()   # 阿拉伯联合酋长国 
    fake.country_code()   # ES 
    fake.credit_card_expire()   # 06/22 
    fake.credit_card_full()   # JCB 16 digit
    柳 冉
    3096337563919187 07/23
    CVC: 610
    
    fake.credit_card_number()   # 6011172478902092 
    fake.credit_card_provider()   # Voyager 
    fake.credit_card_security_code()   # 0753 
    fake.cryptocurrency_code()   # XDN 
    fake.currency_code()   # TWD 
    fake.date()   # 1973-07-31 
    fake.date_between()   # 2008-01-12 
    fake.date_between_dates()   # 2017-12-06 
    fake.date_object()   # 1972-08-01 
    fake.date_this_century()   # 2008-09-16 
    fake.date_this_decade()   # 2013-12-26 
    fake.date_this_month()   # 2017-12-01 
    fake.date_this_year()   # 2017-09-19 
    fake.date_time()   # 2016-08-05 03:23:26 
    fake.date_time_ad()   # 0258-04-07 20:48:11 
    fake.date_time_between()   # 2006-06-09 01:28:22 
    fake.date_time_between_dates()   # 2017-12-06 10:47:23 
    fake.date_time_this_century()   # 2001-11-30 13:58:47 
    fake.date_time_this_decade()   # 2012-08-25 18:04:34 
    fake.date_time_this_month()   # 2017-12-04 11:24:57 
    fake.date_time_this_year()   # 2017-06-02 08:50:48 
    fake.day_of_month()   # 15 
    fake.day_of_week()   # Thursday 
    fake.district()   # 清河 
    fake.domain_name()   # lu.com 
    fake.domain_word()   # zhao 
    fake.ean()   # 5954186746588 
    fake.ean13()   # 9672235528133 
    fake.ean8()   # 06171292 
    fake.email()   # zhengtao@gmail.com 
    fake.file_extension()   # docx 
    fake.file_name()   # 品牌.doc 
    fake.file_path()   # /关于/推荐.pptx 
    fake.firefox()   # Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_7; rv:1.9.4.20) Gecko/2011-01-16 07:23:04 Firefox/5.0 
    fake.first_name()   # 玉珍 
    fake.first_name_female()   # 彬 
    fake.first_name_male()   # 莹 
    fake.first_romanized_name()   # Fang 
    fake.free_email()   # bwen@hotmail.com 
    fake.free_email_domain()   # yahoo.com 
    fake.future_date()   # 2017-12-13 
    fake.future_datetime()   # 2017-12-19 00:29:14 
    fake.geo_coordinate()   # -172.459902 
    fake.hex_color()   # #b4e7a9 
    fake.image_url()   # https://dummyimage.com/517x471 
    fake.internet_explorer()   # Mozilla/5.0 (compatible; MSIE 6.0; Windows CE; Trident/4.0) 
    fake.ipv4()   # 6.155.240.182 
    fake.ipv6()   # 6903:92c5:9e08:5f0c:5fda:b85e:97ec:b885 
    fake.isbn10()   # 0-02-210237-X 
    fake.isbn13()   # 978-1-79735-105-6 
    fake.iso8601()   # 1986-08-09T07:49:59 
    fake.job()   # Designer, graphic 
    fake.language_code()   # bs 
    fake.last_name()   # 逯 
    fake.last_name_female()   # 申 
    fake.last_name_male()   # 查 
    fake.last_romanized_name()   # Dong 
    fake.latitude()   # 10.6496555 
    fake.lexify()   # PEdF 
    fake.license_plate()   # 4-2558G 
    fake.linux_platform_token()   # X11; Linux i686 
    fake.linux_processor()   # i686 
    fake.locale()   # ka_GE 
    fake.longitude()   # -45.494435 
    fake.mac_address()   # 70:0a:bf:0f:77:47 
    fake.mac_platform_token()   # Macintosh; PPC Mac OS X 10_7_7 
    fake.mac_processor()   # Intel 
    fake.md5()   # 71f8c16a5f87000130b7df65611c364a 
    fake.mime_type()   # message/partial 
    fake.month()   # 11 
    fake.month_name()   # February 
    fake.msisdn()   # 6138497580204 
    fake.name()   # 离莹 
    fake.name_female()   # 万成 
    fake.name_male()   # 况丽华 
    fake.null_boolean()   # True 
    fake.numerify()   # 877 
    fake.opera()   # Opera/9.94.(Windows 95; nl-BE) Presto/2.9.171 Version/11.00 
    fake.paragraph()   # 系列位置由于作品什么特别研究.精华网络或者搜索.主题我们类别这个增加. 
    fake.paragraphs()   # [u'u516cu53f8u9700u8981u65f6u95f4u73afu5883.u7684u4ebau63d0u4f9bu79efu5206u5728u7ebfu6807u51c6u6cd5u5f8bu6211u4eecu6ce8u610f.', u'u8c22u8c22u57fau672cu4ec0u4e48u4e2du6587u540du79f0u7136u540eu9996u9875u5de5u5177.u539fu56e0u6ca1u6709u9700u8981u8ba1u5212u5b9eu73b0u89c9u5f97.u7ed3u679cu5f53u524du7814u7a76u5927u5bb6.', u'u7684u8bddu90fdu662fu4e4bu95f4u4e3au4ec0u672cu7ad9u89c4u5b9au5927u5b66.u5206u6790u62e5u6709u800cu4e14u6587u4ef6.'] 
    fake.password()   # z@YJ7Wcpgv 
    fake.past_date()   # 2017-11-22 
    fake.past_datetime()   # 2017-12-03 18:08:05 
    fake.phone_number()   # 18597001558 
    fake.phonenumber_prefix()   # 132 
    fake.postcode()   # 870942 
    fake.profile()   # {'website': [u'https://www.hu.net/', u'https://www.zou.cn/', u'https://shen.cn/', u'http://kong.com/'], 'username': u'wanjing', 'name': u'u79e6u79c0u5170', 'blood_group': '0+', 'residence': u'u8fbdu5b81u7701u5e06u53bfu79c0u82f1u516du76d8u6c34u8857uu5ea7 436149', 'company': u'u9ec4u77f3u91d1u627fu4fe1u606fu6709u9650u516cu53f8', 'address': u'u897fu85cfu81eau6cbbu533au51e4u5170u53bfu5c71u4eadu94f6u5dddu8857Pu5ea7 346744', 'birthdate': '1985-04-28', 'sex': 'M', 'job': 'Engineer, mining', 'ssn': u'433125195206070070', 'current_location': (Decimal('-15.7126615'), Decimal('-143.411020')), 'mail': u'fliang@hotmail.com'} 
    fake.province()   # 广西壮族自治区 
    fake.pybool()   # True 
    fake.pydecimal()   # 384.433560097 
    fake.pydict()   # {u'u5927u5bb6': u'https://www.gao.net/categories/categories/index.php', u'u90a3u4e48': 4623, u'u72b6u6001': datetime.datetime(1994, 3, 19, 8, 6, 12), u'u80fdu529b': Decimal('6.96492'), u'u540cu65f6': u'JpjrByPDCgnsNDfaNYgd', u'u5ba2u6237': 3485} 
    fake.pyfloat()   # -4099208226.9 
    fake.pyint()   # 3270 
    fake.pyiterable()   # [-7155.447707, u'KOQVBTsYxVpaVxpHBXiO', u'https://www.kang.com/index.php', u'jKmLqgUUOEqdXCeTGBID', u'pGVNjKcxmCTQNpdpKbgm', -48.1915257969, datetime.datetime(1975, 9, 27, 18, 22, 43)] 
    fake.pylist()   # [4770, datetime.datetime(1990, 4, 11, 9, 59, 16), 2546, 8087, -612180.919, 2.3246212976] 
    fake.pyset()   # set([u'uwFlxgSEwApkViCNpQZk', u'TlijxYEXankqWtWXkHax', u'TPgKtCtIHXIaKxgWMDjo', Decimal('-72118073288.1'), u'LYoqafrVUVggsnWJXKUg', Decimal('-239813.3099'), u'ELLFUOSNKtxYyhtCXPPg', 1371]) 
    fake.pystr()   # GdxudJdOCeExecGzFpJg 
    fake.pystruct()   # ([u'WTHzKZdDIrwhUfPHrjMb', u'MVXsSqDWyabyceZRSgGr', datetime.datetime(1993, 10, 3, 1, 1, 31), u'sKcZHJgAGVZrCIfIHwMS', 7694, u'wdedDezTMpfOxUQHaVlO', u'iMgUrRzaaYtArWrnxWda', u'tixihvoqNqQVByfEoGsg', u'https://www.qiu.com/search/explore/home.html', 898068606944.83], {u'u6709u9650': Decimal('4.3883198'), u'u8fd9u4e48': u'UVOyihAmcukcQJcVIOah', u'u5408u4f5c': 3743, u'u4e0du540c': datetime.datetime(2005, 2, 23, 7, 35, 45), u'u63d0u9ad8': datetime.datetime(1987, 2, 10, 2, 28, 44), u'u8bc4u8bba': 8874, u'u5173u4e8e': u'apan@wei.net', u'u7ec4u7ec7': 468, u'u60c5u51b5': 6083, u'u884cu4e1a': u'qiang61@long.org'}, {u'u4e13u4e1a': {3: u'AkBWAoxmmokgNrRogyYk', 4: [4596, u'nJzscDjtYSbEzPdkOkRK', 5365], 5: {3: 4605, 4: u'chao87@wei.com', 5: [u'xia30@lu.cn', datetime.datetime(2006, 10, 25, 21, 37, 41)]}}, u'u4e2du6587': {8: [u'oYYfArTznrMITieKBrdT', u'QoESvZcnaAZFmaQqjrgk', u'afkzJChqTNmwwcUXcTOu'], 9: {8: u'ughNWEsmKFFnPReWycbf', 9: [-6.41272, -39213.981], 7: u'RKIcxKTOThQLwaIgVFWe'}, 7: u'uIVZuDPnedhnOJVZUzfX'}, u'u8fd8u662f': {9: u'JqElYMJfaassiofLGvLn', 10: [4443, u'aZgiftVvonSEzCzTddiO', u'shaowei@yan.com'], 11: {9: 9967, 10: 5143, 11: [u'usmTtsPWPYtObuYObOpB', Decimal('-31192.5654601')]}}, u'u6765u81ea': {1: u'sIqUyGCneohdHGgznDuU', 2: [datetime.datetime(2007, 5, 31, 11, 24, 16), 8321, u'pfIJmDxwAquYLyxrpuVz'], 3: {1: u'gliang@hotmail.com', 2: Decimal('33965.0'), 3: [u'AexgPcuhOIziJhYifZtR', datetime.datetime(2003, 3, 24, 22, 28, 43)]}}, u'u7cfbu7edf': {4: u'welRgeLqhOQPGkdkviok', 5: [Decimal('-46.5'), u'hmJxbwRBLukmjHylLojM', u'http://www.mao.cn/search/tag/index.html'], 6: {4: u'http://zou.cn/tag/index/', 5: u'uBlLVOtLauDbAMlrpTZM', 6: [u'bqiHwnSArJdlQnvsbKPN', u'RQdmtWPMwiFuaThJrMWm']}}, u'u6280u672f': {8: 2626, 9: [Decimal('4719860282.19'), Decimal('-392046163.17'), datetime.datetime(2005, 1, 11, 13, 21, 2)], 10: {8: u'MoUiPqxBcSTrkudFLIza', 9: u'XUQtWQGntEeuayziAnYA', 10: [u'ulhMPZKMdlQzfWdUuYIF', datetime.datetime(1994, 7, 25, 9, 15, 28)]}}, u'u9009u62e9': {8: {8: [u'yong58@ren.cn', u'cGFuWyLdFRUzGhTCaFjE'], 6: 7701, 7: datetime.datetime(2010, 8, 15, 10, 6, 13)}, 6: u'zengwei@gmail.com', 7: [6858, 6403, datetime.datetime(1984, 4, 18, 11, 0, 12)]}, u'u4e00u70b9': {0: 6620, 1: [u'OrTScuyESDqszlQjOlYX', u'hJahyMWdkPLhNOMzrdfy', u'mmZYqEDMYPodgUuICyct'], 2: {0: -33313798379.385, 1: u'XRpLoRsRMQIROsBqIHlG', 2: [u'xZozzLqTMwXpfdTpMscc', u'https://www.xia.com/']}}, u'u7531u4e8e': {2: u'naguo@qian.com', 3: [u'wTVRQMbwJPUNAKbhAKFs', Decimal('-679732200.8'), u'braeyLsfMvOtsSrgwlxX'], 4: {2: u'feviQSXEPjAzICRiXIWU', 3: u'xiuyinghe@gmail.com', 4: [5961281603639.0, u'YNOuECSZEExtHvlGKwwE']}}, u'u56feu7247': {5: datetime.datetime(1977, 3, 29, 23, 38), 6: [u'http://yin.com/main.jsp', u'yanjia@yahoo.com', 632.53909299766], 7: {5: u'RqBzkDuehAQUCHYQCmAZ', 6: 4597, 7: [8421, 7708]}}}) 
    fake.pytuple()   # (u'CJFHMwspGSwiPKfZhCVY', u'IDhxTOsuOiDHOlKtMbbe', 6637, 978, u'RodatDSuaRbwlgTJNzKx', u'fsUVemSiAyPqyLFmfdZD', u'zhujuan@li.cn', u'https://kong.cn/categories/app/login.htm', Decimal('-406039.250589'), 8127) 
    fake.random_digit()   # 9 
    fake.random_digit_not_null()   # 6 
    fake.random_digit_not_null_or_empty()   # 5 
    fake.random_digit_or_empty()   # 3 
    fake.random_element()   # a 
    fake.random_int()   # 4585 
    fake.random_letter()   # o 
    fake.random_number()   # 80709883 
    fake.random_sample()   # ['a', 'c'] 
    fake.random_sample_unique()   # set(['a', 'c', 'b']) 
    fake.randomize_nb_elements()   # 13 
    fake.rgb_color()   # 97,134,130 
    fake.rgb_css_color()   # rgb(39,226,180) 
    fake.romanized_name()   # Qiang Du 
    fake.safari()   # Mozilla/5.0 (Windows; U; Windows NT 6.0) AppleWebKit/532.2.5 (KHTML, like Gecko) Version/4.0.2 Safari/532.2.5 
    fake.safe_color_name()   # yellow 
    fake.safe_email()   # ming14@example.net 
    fake.safe_hex_color()   # #ff3300 
    fake.sentence()   # 方法科技是否只有无法. 
    fake.sentences()   # [u'u4ec0u4e48u672cu7ad9u6280u672fu4e00u6b21u8868u793au4e0du540cu5904u7406.', u'u8fd0u884cu65b9u5f0fu80fdu529bu4e00u6837u5f53u524d.', u'u6700u65b0u901au8fc7u4e00u4e2au5b66u6821u5f53u524du4ecau5e74u5982u679cu5efau8bbe.'] 
    fake.sha1()   # 7052c75358562302ddacd77e14e49986926374fa 
    fake.sha256()   # 27e24e47230c764507a2e54d25a495e2f1f24ebcc23c6bf2b213b21379f8865e 
    fake.simple_profile()   # {'username': u'nayuan', 'name': u'u5b87u9633', 'birthdate': '1975-11-12', 'sex': 'M', 'address': u'u6c5fu897fu7701u6f5cu6c5fu53bfu6c38u5dddu62d3u8defju5ea7 699193', 'mail': u'guiying19@hotmail.com'} 
    fake.ssn()   # 410403194106288547 
    fake.street_address()   # 燕街L座 
    fake.street_name()   # 广州街 
    fake.street_suffix()   # 路 
    fake.text()   # 留言大小看到.成为控制拥有.
    电子个人产品产品这么其他文章.国际谢谢公司系统为什.一起其他作品客户一种系列.
    事情中国记者.男人为什组织的话.
    要求部门希望.很多投资深圳方面操作威望需要.
    注意你们这种学生可是所有通过基本.游戏时候日本目前数据生活得到.
    市场这是还是学校时间最后.关于之后浏览相关企业支持结果类别.正在专业人员实现. 
    fake.time()   # 17:02:29 
    fake.time_delta()   # 8837 days, 21:54:15 
    fake.time_object()   # 03:34:28 
    fake.time_series()   # <generator object time_series at 0x7ff7800cb280> 
    fake.timezone()   # Asia/Jerusalem 
    fake.tld()   # cn 
    fake.unix_time()   # 1100321594 
    fake.uri()   # https://pan.org/terms/ 
    fake.uri_extension()   # .php 
    fake.uri_page()   # login 
    fake.uri_path()   # app/category 
    fake.url()   # http://www.xie.com/ 
    fake.user_agent()   # Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_6; rv:1.9.5.20) Gecko/2016-10-29 04:38:17 Firefox/12.0 
    fake.user_name()   # jingmo 
    fake.uuid4()   # f64bcfad-67c4-c748-5e19-86a74848e6fa 
    fake.windows_platform_token()   # Windows NT 5.2 
    fake.word()   # 更新 
    fake.words()   # [u'u7136u540e', u'u5927u5b66', u'u7a0bu5e8f'] 
    fake.year()   # 2001 
  • 相关阅读:
    ssm依赖
    NSNotificationCenter详解
    Objective-C语法之代码块(block)的使用
    IOS UI UITableView
    IOS 多线程(4) --线程通讯
    IOS 多线程(3) --线程安全
    IOS 多线程(2) --NSThread
    IOS 多线程(1) --基础知识
    IOS UI TextFiled常用总结
    IOS UI TabBar标签栏的使用
  • 原文地址:https://www.cnblogs.com/superscfan/p/12257033.html
Copyright © 2011-2022 走看看