python 랜 덤 생 성 라 이브 러 리 faker 라 이브 러 리 api 실례 상세 설명

5361 단어 pythonfakerapi
쓸데없는 말 은 그만 하고 코드 를 바로 달 아 라!

# -*- coding: utf-8 -*-
# @Author : FELIX
# @Date  : 2018/6/30 9:49

from faker import Factory

# zh_CN        
fake = Factory().create('zh_CN')
#        
print(fake.phone_number())
#       
print(fake.name())
#       
print(fake.address())
#        
print(fake.country())
#         
print(fake.country_code())
#        
print(fake.city_name())
#       
print(fake.city())
#       
print(fake.province())
#     email
print(fake.email())
#     IPV4  
print(fake.ipv4())
#                     
print(fake.pystr(min_chars=0, max_chars=8))

#        
print(fake.license_plate())

#       
print(fake.rgb_color()) # rgb
print(fake.safe_hex_color()) # 16  
print(fake.color_name()) #     
print(fake.hex_color()) # 16  

#        
print(fake.company())


#         
print(fake.job())
#       
print(fake.password(length=10, special_chars=True, digits=True, upper_case=True, lower_case=True))
#     uuid
print(fake.uuid4())
#     sha1
print(fake.sha1(raw_output=False))
#     md5
print(fake.md5(raw_output=False))

#         
print(fake.name_female())
#     
print(fake.name_male())
#       
print(fake.name())

#       
print(fake.profile(fields=None, sex=None))
print(fake.simple_profile(sex=None))

#         user_agent
print(fake.user_agent())

#       
fake.month_name()
# 'September'
fake.date_time_this_century(before_now=True, after_now=False, tzinfo=None)
# datetime.datetime(2010, 7, 21, 18, 52, 43)
fake.time_object(end_datetime=None)
# datetime.time(6, 39, 26)
fake.date_time_between(start_date="-30y", end_date="now", tzinfo=None)
# datetime.datetime(2013, 10, 11, 18, 43, 40)
fake.future_date(end_date="+30d", tzinfo=None)
# datetime.date(2018, 7, 8)
fake.date_time(tzinfo=None, end_datetime=None)
# datetime.datetime(2006, 9, 4, 20, 46, 6)
fake.date(pattern="%Y-%m-%d", end_datetime=None)
# '1998-08-02'
fake.date_time_this_month(before_now=True, after_now=False, tzinfo=None)
# datetime.datetime(2018, 6, 8, 9, 56, 24)
fake.timezone()
# 'Africa/Conakry'
fake.date_time_this_decade(before_now=True, after_now=False, tzinfo=None)
# datetime.datetime(2017, 6, 27, 21, 18, 28)
fake.month()
# '04'
fake.day_of_week()
# 'Wednesday'
fake.iso8601(tzinfo=None, end_datetime=None)
# '1988-02-28T09:22:29'
fake.time_delta(end_datetime=None)
# datetime.timedelta(10832, 82660)
fake.date_object(end_datetime=None)
# datetime.date(2005, 8, 18)
fake.date_this_decade(before_today=True, after_today=False)
# datetime.date(2015, 1, 5)
fake.date_this_century(before_today=True, after_today=False)
# datetime.date(2000, 6, 1)
fake.date_this_month(before_today=True, after_today=False)
# datetime.date(2018, 6, 13)
fake.am_pm()
# 'AM'
fake.past_datetime(start_date="-30d", tzinfo=None)
# datetime.datetime(2018, 6, 25, 7, 41, 34)
fake.date_this_year(before_today=True, after_today=False)
# datetime.date(2018, 2, 24)
fake.date_time_between_dates(datetime_start=None, datetime_end=None, tzinfo=None)
# datetime.datetime(2018, 6, 26, 14, 40, 5)
fake.date_time_ad(tzinfo=None, end_datetime=None)
# datetime.datetime(673, 1, 28, 18, 17, 55)
fake.date_between_dates(date_start=None, date_end=None)
# datetime.date(2018, 6, 26)
fake.future_datetime(end_date="+30d", tzinfo=None)
# datetime.datetime(2018, 7, 4, 10, 53, 6)
fake.century()
# 'IX'
fake.past_date(start_date="-30d", tzinfo=None)
# datetime.date(2018, 5, 30)
fake.time(pattern="%H:%M:%S", end_datetime=None)
# '01:32:14'
fake.day_of_month()
# '19'
fake.unix_time(end_datetime=None, start_datetime=None)
# 1284297794
fake.date_time_this_year(before_now=True, after_now=False, tzinfo=None)
# datetime.datetime(2018, 5, 24, 11, 25, 25)
fake.date_between(start_date="-30y", end_date="today")
# datetime.date(2003, 1, 11)
fake.year()
# '1993'
fake.time_series(start_date="-30d", end_date="now", precision=None, distrib=None, tzinfo=None)
# <generator object time_series at 0x7f44e702a620>


#       
fake.file_extension(category=None)
# 'xls'
fake.file_name(category=None, extension=None)
# '  .csv'
fake.file_path(depth=1, category=None, extension=None)
# '/  /  .js'
fake.unix_device(prefix=None)
# '/dev/sdf'
fake.unix_partition(prefix=None)
# '/dev/vdf0'
fake.mime_type(category=None)
# 'multipart/form-data'
이상 의 python 랜 덤 생 성 라 이브 러 리 faker 라 이브 러 리 api 인 스 턴 스 상세 한 설명 은 바로 작은 편집 이 여러분 에 게 공유 하 는 모든 내용 입 니 다.참고 가 되 고 저 희 를 많이 사랑 해 주 셨 으 면 좋 겠 습 니 다.

좋은 웹페이지 즐겨찾기