程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Detailed summary of Python faker Library (randomly generated data)

編輯:Python

faker Mainly used to create pseudo data , Use Faker package , There is no need to generate data manually or by hand , Just call Faker Methods provided , Data generation can be completed .

install

pip install faker

If it cannot be installed, it can be followed by the image source

Official documents

Welcome to Faker’s documentation! — Faker 13.0.0 documentation

Summary of common methods :

Geographic Information


city_suffix(): City , county
country(): Country
country_code(): Country code
district(): District
geo_coordinate(): Geographical coordinates
latitude(): Geographical coordinates ( latitude )
longitude(): Geographical coordinates ( longitude )
postcode(): Zip code
province(): Province (zh_TW There is no such way )
address(): Detailed address
street_address(): Street address
street_name(): Street name
street_suffix(): Street, 、 road 

Basic information class

ssn(): Generate ID number
 
bs(): Random company service name
 
company(): Random company name ( Long )
 
company_prefix(): Random company name ( short )
 
company_suffix(): The nature of the company
 
credit_card_expire(): Random credit card expiration date
 
credit_card_full(): Generate complete credit card information
 
credit_card_number(): Credit card number
 
credit_card_provider(): Credit card type
 
credit_card_security_code(): Credit card security code
 
job(): Random position
 
first_name():
 
first_name_female(): Female name
 
first_name_male(): Male name
 
first_romanized_name(): Roman name
 
last_name():
 
last_name_female(): Maiden name
 
last_name_male(): Male surname
 
last_romanized_name():
 
name(): Randomly generate full name
 
name_female(): Male full name
 
name_male(): Woman's full name
 
romanized_name(): Roman name
 
msisdn(): International subscriber identification number of mobile station , That is, mobile users ISDN number
 
phone_number(): Randomly generate cell phone number
 
phonenumber_prefix(): Randomly generate cell phone number segment 

Personal account information class

ascii_company_email(): Random ASCII Company email
ascii_email(): Random ASCII mailbox
ascii_free_email():
ascii_safe_email():
company_email():
email():
free_email():
free_email_domain():
safe_email(): Secure email 

Network basic information class

domain_name(): Generate domain name
domain_word(): Domain words ( namely , No suffix )
ipv4(): Random IP4 Address
ipv6(): Random IP6 Address
mac_address(): Random MAC Address
tld(): The suffix of the website domain name (.com,.net.cn, wait , barring .)
uri(): Random URI Address
uri_extension(): URL file suffix
uri_page(): Website file ( No suffix )
uri_path(): URL file path ( Does not contain a filename )
url(): Random URL Address
user_name(): Random user name
image_url(): Random URL Address 

Browser information class

chrome(): Random generation Chrome Browser user_agent Information
firefox(): Random generation FireFox Browser user_agent Information
internet_explorer(): Random generation IE Browser user_agent Information
opera(): Random generation Opera Browser user_agent Information
safari(): Random generation Safari Browser user_agent Information
linux_platform_token(): Random Linux Information
user_agent(): Random user_agent Information 

File information class

file_extension(): Random file extension
file_name(): Random filename ( Include extension , Path not included )
file_path(): Random file path ( Include file name , Extension )
mime_type(): Random mime Type

Digital class

numerify(): Three random numbers
random_digit():0~9 random number
random_digit_not_null():1~9 The random number
random_int(): Random numbers , Default 0~9999, Can be set by min,max To set up
random_number(): Random numbers , Parameters digits Set the number of digits generated
pyfloat():left_digits=5 # The number of integers generated ,
right_digits=2 # The number of decimal places generated ,
positive=True # Whether there are only positive numbers
pyint(): Random Int Numbers ( Reference resources random_int() Parameters )
pydecimal(): Random Decimal Numbers ( Reference resources pyfloat Parameters )

Text 、 Encryption class

pystr(): Random string
random_element(): Random letters
random_letter(): Random letters
paragraph(): Randomly generate a paragraph
paragraphs(): Generate multiple paragraphs at random , Through parameters nb To control the number of paragraphs , Returns an array of
sentence(): Randomly generate a sentence
sentences(): Generate multiple sentences at random , Similar to paragraph
text(): Randomly generate an article ( Don't fantasize about AI , So far, I haven't fully understood what a sentence means )
word(): Randomly generate words
words(): Generate multiple words at random , Usage and paragraph , The sentence , similar
binary(): Randomly generate binary code
boolean():True/False
language_code(): Randomly generate two bit language code
locale(): Randomly generated language / The international Information
md5(): Random generation MD5
null_boolean():NULL/True/False
password(): Randomly generated password , Optional parameters :length: Password length ;special_chars: Can I use special characters ;digits: Include numbers ;upper_case: Whether it contains capital letters ;lower_case: Whether it contains lowercase letters
sha1(): Random SHA1
sha256(): Random SHA256
uuid4(): Random UUID

Time information class

am_pm():AM/PM
century(): Random century
date(): Random date
date_between(): Randomly generate the date within the specified range , Parameters :start_date,end_date Value : A specific date or today,-30d,-30y similar
date_between_dates(): Randomly generate the date within the specified range , Same as above
date_object(): Random production from 1970-1-1 A random date to a specified date .
date_this_month():
date_this_year():
date_time(): Randomly generate the specified time (1970 year 1 month 1 since )
date_time_ad(): Generate ad 1 Years to now, random time
date_time_between(): Use the same dates
future_date(): Future date
future_datetime(): Future time
month(): Random months
month_name(): Random months ( english )
past_date(): Randomly generate past dates
past_datetime(): Random generation of time that has passed
time(): Random 24 Hour time
timedelta(): Time difference of random acquisition
time_object(): Random 24 Hour time ,time object
time_series(): Random TimeSeries object
timezone(): Random time zone
unix_time(): Random Unix Time
year(): Random year 

Set information class

profile(): Randomly generate file information
simple_profile(): Generate simple file information randomly 


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved