關於Python-faker的函式效果一覽
阿新 • • 發佈:2020-01-09
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} \n".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() # [email protected] fake.ascii_email() # [email protected] fake.ascii_free_email() # [email protected] fake.ascii_safe_email() # [email protected] 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() # [email protected] 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() # [email protected] 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() # [email protected] 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'\u516c\u53f8\u9700\u8981\u65f6\u95f4\u73af\u5883.\u7684\u4eba\u63d0\u4f9b\u79ef\u5206\u5728\u7ebf\u6807\u51c6\u6cd5\u5f8b\u6211\u4eec\u6ce8\u610f.',u'\u8c22\u8c22\u57fa\u672c\u4ec0\u4e48\u4e2d\u6587\u540d\u79f0\u7136\u540e\u9996\u9875\u5de5\u5177.\u539f\u56e0\u6ca1\u6709\u9700\u8981\u8ba1\u5212\u5b9e\u73b0\u89c9\u5f97.\u7ed3\u679c\u5f53\u524d\u7814\u7a76\u5927\u5bb6.',u'\u7684\u8bdd\u90fd\u662f\u4e4b\u95f4\u4e3a\u4ec0\u672c\u7ad9\u89c4\u5b9a\u5927\u5b66.\u5206\u6790\u62e5\u6709\u800c\u4e14\u6587\u4ef6.'] 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'\u79e6\u79c0\u5170','blood_group': '0+','residence': u'\u8fbd\u5b81\u7701\u5e06\u53bf\u79c0\u82f1\u516d\u76d8\u6c34\u8857u\u5ea7 436149','company': u'\u9ec4\u77f3\u91d1\u627f\u4fe1\u606f\u6709\u9650\u516c\u53f8','address': u'\u897f\u85cf\u81ea\u6cbb\u533a\u51e4\u5170\u53bf\u5c71\u4ead\u94f6\u5ddd\u8857P\u5ea7 346744','birthdate': '1985-04-28','sex': 'M','job': 'Engineer,mining','ssn': u'433125195206070070','current_location': (Decimal('-15.7126615'),Decimal('-143.411020')),'mail': u'[email protected]'} fake.province() # 廣西壯族自治區 fake.pybool() # True fake.pydecimal() # 384.433560097 fake.pydict() # {u'\u5927\u5bb6': u'https://www.gao.net/categories/categories/index.php',u'\u90a3\u4e48': 4623,u'\u72b6\u6001': datetime.datetime(1994,3,19,8,6,12),u'\u80fd\u529b': Decimal('6.96492'),u'\u540c\u65f6': u'JpjrByPDCgnsNDfaNYgd',u'\u5ba2\u6237': 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,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,1,31),u'sKcZHJgAGVZrCIfIHwMS',7694,u'wdedDezTMpfOxUQHaVlO',u'iMgUrRzaaYtArWrnxWda',u'tixihvoqNqQVByfEoGsg',u'https://www.qiu.com/search/explore/home.html',898068606944.83],{u'\u6709\u9650': Decimal('4.3883198'),u'\u8fd9\u4e48': u'UVOyihAmcukcQJcVIOah',u'\u5408\u4f5c': 3743,u'\u4e0d\u540c': datetime.datetime(2005,2,23,7,35,45),u'\u63d0\u9ad8': datetime.datetime(1987,28,44),u'\u8bc4\u8bba': 8874,u'\u5173\u4e8e': u'[email protected]',u'\u7ec4\u7ec7': 468,u'\u60c5\u51b5': 6083,u'\u884c\u4e1a': u'[email protected]'},{u'\u4e13\u4e1a': {3: u'AkBWAoxmmokgNrRogyYk',4: [4596,u'nJzscDjtYSbEzPdkOkRK',5365],5: {3: 4605,4: u'[email protected]',5: [u'[email protected]',datetime.datetime(2006,25,21,37,41)]}},u'\u4e2d\u6587': {8: [u'oYYfArTznrMITieKBrdT',u'QoESvZcnaAZFmaQqjrgk',u'afkzJChqTNmwwcUXcTOu'],9: {8: u'ughNWEsmKFFnPReWycbf',9: [-6.41272,-39213.981],7: u'RKIcxKTOThQLwaIgVFWe'},7: u'uIVZuDPnedhnOJVZUzfX'},u'\u8fd8\u662f': {9: u'JqElYMJfaassiofLGvLn',10: [4443,u'aZgiftVvonSEzCzTddiO',u'[email protected]'],11: {9: 9967,10: 5143,11: [u'usmTtsPWPYtObuYObOpB',Decimal('-31192.5654601')]}},u'\u6765\u81ea': {1: u'sIqUyGCneohdHGgznDuU',2: [datetime.datetime(2007,5,31,24,8321,u'pfIJmDxwAquYLyxrpuVz'],3: {1: u'[email protected]',2: Decimal('33965.0'),3: [u'AexgPcuhOIziJhYifZtR',datetime.datetime(2003,43)]}},u'\u7cfb\u7edf': {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'\u6280\u672f': {8: 2626,9: [Decimal('4719860282.19'),Decimal('-392046163.17'),datetime.datetime(2005,13,2)],10: {8: u'MoUiPqxBcSTrkudFLIza',9: u'XUQtWQGntEeuayziAnYA',10: [u'ulhMPZKMdlQzfWdUuYIF',datetime.datetime(1994,15,28)]}},u'\u9009\u62e9': {8: {8: [u'[email protected]',u'cGFuWyLdFRUzGhTCaFjE'],6: 7701,7: datetime.datetime(2010,13)},6: u'[email protected]',7: [6858,6403,datetime.datetime(1984,12)]},u'\u4e00\u70b9': {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'\u7531\u4e8e': {2: u'[email protected]',3: [u'wTVRQMbwJPUNAKbhAKFs',Decimal('-679732200.8'),u'braeyLsfMvOtsSrgwlxX'],4: {2: u'feviQSXEPjAzICRiXIWU',3: u'[email protected]',4: [5961281603639.0,u'YNOuECSZEExtHvlGKwwE']}},u'\u56fe\u7247': {5: datetime.datetime(1977,29,38),6: [u'http://yin.com/main.jsp',u'[email protected]',632.53909299766],7: {5: u'RqBzkDuehAQUCHYQCmAZ',6: 4597,7: [8421,7708]}}}) fake.pytuple() # (u'CJFHMwspGSwiPKfZhCVY',u'IDhxTOsuOiDHOlKtMbbe',6637,978,u'RodatDSuaRbwlgTJNzKx',u'fsUVemSiAyPqyLFmfdZD',u'[email protected]',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() # [email protected] fake.safe_hex_color() # #ff3300 fake.sentence() # 方法科技是否只有無法. fake.sentences() # [u'\u4ec0\u4e48\u672c\u7ad9\u6280\u672f\u4e00\u6b21\u8868\u793a\u4e0d\u540c\u5904\u7406.',u'\u8fd0\u884c\u65b9\u5f0f\u80fd\u529b\u4e00\u6837\u5f53\u524d.',u'\u6700\u65b0\u901a\u8fc7\u4e00\u4e2a\u5b66\u6821\u5f53\u524d\u4eca\u5e74\u5982\u679c\u5efa\u8bbe.'] fake.sha1() # 7052c75358562302ddacd77e14e49986926374fa fake.sha256() # 27e24e47230c764507a2e54d25a495e2f1f24ebcc23c6bf2b213b21379f8865e fake.simple_profile() # {'username': u'nayuan','name': u'\u5b87\u9633','birthdate': '1975-11-12','address': u'\u6c5f\u897f\u7701\u6f5c\u6c5f\u53bf\u6c38\u5ddd\u62d3\u8defj\u5ea7 699193','mail': u'[email protected]'} 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'\u7136\u540e',u'\u5927\u5b66',u'\u7a0b\u5e8f'] fake.year() # 2001
以上這篇關於Python-faker的函式效果一覽就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支援我們。