python妯″潡涓€涔媐aker妯″潡
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python妯″潡涓€涔媐aker妯″潡相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/locale' title='locale'>locale
鏂囦欢 tld 鏈嶅姟 date 甯哥敤 time bool tryfaker妯″潡涓昏鏄敤鏉ュ垱寤轰吉鏁版嵁锛屾棤闇€鎵嬪姩鐢熸垚鎴栬€呮墜鍐欓殢鏈烘暟鏉ョ敓鎴愭暟鎹紝鍙互鍒╃敤faker瀹屾垚浼€犲ぇ閲忔祴璇曟暟鎹殑宸ヤ綔
涓€銆佸畨瑁?/p>
pip install faker
浜屻€佷娇鐢?/p>
from faker import Faker
f = Faker(locale=鈥榸h_CN鈥? #涓虹敓鎴愭暟鎹殑鏂囧寲閫夐」锛岄粯璁や负en_US锛屽彧鏈変娇鐢ㄤ簡鐩稿叧鏂囧寲锛屾墠鑳界敓鎴愬搴旂殑闅忔満淇℃伅锛岀敱浜庢枃鍖栧樊寮傦紝璁剧疆鏂囧寲鐨勬椂鍊欎細瀵艰嚧鏈変簺瀛楁姣斿鐪佷唤绛変細鍑虹幇鏂规硶鎶ラ敊绛夐棶棰?/p>
for i in range(5):
print(f.name() + ":" + f.address()) #闅忔満鐢熸垚涓枃濮撳悕鍜屽湴鍧€,name()鍑芥暟鐢熸垚濮撳悕锛宎ddress()鍑芥暟鐢熸垚鍦板潃
涓夈€佸父鐢ㄥ嚱鏁颁粙缁?/p>
city_suffix()锛氬競锛屽幙
country()锛氬浗瀹?/p>
country_code()锛氬浗瀹剁紪鐮?/p>
district()锛氬尯
geo_coordinate()锛氬湴鐞嗗潗鏍?/p>
latitude()锛氬湴鐞嗗潗鏍?绾害)
longitude()锛氬湴鐞嗗潗鏍?缁忓害)
lexify()锛氭浛鎹㈡墍鏈夐棶鍙凤紙“锛?rdquo;锛夊甫鏈夐殢鏈哄瓧姣嶇殑浜嬩欢銆?/p>
numerify()锛氫笁浣嶉殢鏈烘暟瀛?/p>
postcode()锛氶偖缂?/p>
province()锛氱渷浠?/p>
street_address()锛氳閬撳湴鍧€
street_name()锛氳閬撳悕
street_suffix()锛氳銆佽矾
random_digit()锛?~9闅忔満鏁?/p>
random_digit_not_null()锛?~9鐨勯殢鏈烘暟
random_element()锛氶殢鏈哄瓧姣?/p>
random_int()锛氶殢鏈烘暟瀛楋紝榛樿0~9999锛屽彲浠ラ€氳繃璁剧疆min,max鏉ヨ缃?/p>
random_letter()锛氶殢鏈哄瓧姣?/p>
random_number()锛氶殢鏈烘暟瀛楋紝鍙傛暟digits璁剧疆鐢熸垚鐨勬暟瀛椾綅鏁?/p>
color_name()锛氶殢鏈洪鑹插悕
hex_color()锛氶殢鏈篐EX棰滆壊
rgb_color()锛氶殢鏈篟GB棰滆壊
safe_color_name()锛氶殢鏈哄畨鍏ㄨ壊鍚?/p>
safe_hex_color()锛氶殢鏈哄畨鍏℉EX棰滆壊
bs()锛氶殢鏈哄叕鍙告湇鍔″悕
company()锛氶殢鏈哄叕鍙稿悕锛堥暱锛?/p>
company_prefix()锛氶殢鏈哄叕鍙稿悕锛堢煭锛?/p>
company_suffix()锛氬叕鍙告€ц川
credit_card_expire()锛氶殢鏈轰俊鐢ㄥ崱鍒版湡鏃?/p>
credit_card_full()锛氱敓鎴愬畬鏁翠俊鐢ㄥ崱淇℃伅
credit_card_number()锛氫俊鐢ㄥ崱鍙?/p>
credit_card_provider()锛氫俊鐢ㄥ崱绫诲瀷
credit_card_security_code()锛氫俊鐢ㄥ崱瀹夊叏鐮?/p>
currency_code()锛氳揣甯佺紪鐮?/p>
am_pm()锛欰M/PM
century()锛氶殢鏈轰笘绾?/p>
date()锛氶殢鏈烘棩鏈?/p>
date_between()锛氶殢鏈虹敓鎴愭寚瀹氳寖鍥村唴鏃ユ湡锛屽弬鏁帮細start_date锛宔nd_date鍙栧€硷細鍏蜂綋鏃ユ湡鎴栬€卼oday,-30d,-30y绫讳技
date_between_dates()锛氶殢鏈虹敓鎴愭寚瀹氳寖鍥村唴鏃ユ湡锛岀敤娉曞悓涓?/p>
date_object()锛氶殢鏈虹敓浜т粠1970-1-1鍒版寚瀹氭棩鏈熺殑闅忔満鏃ユ湡銆?/p>
date_this_month()锛?/p>
date_this_year()锛?/p>
date_time()锛氶殢鏈虹敓鎴愭寚瀹氭椂闂达紙1970骞?鏈?鏃ヨ嚦浠婏級
date_time_ad()锛氱敓鎴愬叕鍏?骞村埌鐜板湪鐨勯殢鏈烘椂闂?/p>
date_time_between()锛氱敤娉曞悓dates
future_date()锛氭湭鏉ユ棩鏈?/p>
future_datetime()锛氭湭鏉ユ椂闂?/p>
month()锛氶殢鏈烘湀浠?/p>
month_name()锛氶殢鏈烘湀浠斤紙鑻辨枃锛?/p>
past_date()锛氶殢鏈虹敓鎴愬凡缁忚繃鍘荤殑鏃ユ湡
past_datetime()锛氶殢鏈虹敓鎴愬凡缁忚繃鍘荤殑鏃堕棿
time()锛氶殢鏈?4灏忔椂鏃堕棿
timedelta()锛氶殢鏈鸿幏鍙栨椂闂村樊
time_object()锛氶殢鏈?4灏忔椂鏃堕棿锛宼ime瀵硅薄
time_series()锛氶殢鏈篢imeSeries瀵硅薄
timezone()锛氶殢鏈烘椂鍖?/p>
unix_time()锛氶殢鏈篣nix鏃堕棿
year()锛氶殢鏈哄勾浠?/p>
file_extension()锛氶殢鏈烘枃浠舵墿灞曞悕
file_name()锛氶殢鏈烘枃浠跺悕锛堝寘鍚墿灞曞悕锛屼笉鍖呭惈璺緞锛?/p>
file_path()锛氶殢鏈烘枃浠惰矾寰勶紙鍖呭惈鏂囦欢鍚嶏紝鎵╁睍鍚嶏級
mime_type()锛氶殢鏈簃ime Type
ascii_company_email()锛氶殢鏈篈SCII鍏徃閭鍚?/p>
ascii_email()锛氶殢鏈篈SCII閭
ascii_free_email()锛?/p>
ascii_safe_email()锛?/p>
company_email()锛?/p>
domain_name()锛氱敓鎴愬煙鍚?/p>
domain_word()锛氬煙璇?鍗筹紝涓嶅寘鍚悗缂€)
email()锛?/p>
free_email()锛?/p>
free_email_domain()锛?/p>
f.safe_email()锛氬畨鍏ㄩ偖绠?/p>
f.image_url()锛氶殢鏈篣RL鍦板潃
ipv4()锛氶殢鏈篒P4鍦板潃
ipv6()锛氶殢鏈篒P6鍦板潃
mac_address()锛氶殢鏈篗AC鍦板潃
tld()锛氱綉鍧€鍩熷悕鍚庣紑(.com,.net.cn,绛夌瓑锛屼笉鍖呮嫭.)
uri()锛氶殢鏈篣RI鍦板潃
uri_extension()锛氱綉鍧€鏂囦欢鍚庣紑
uri_page()锛氱綉鍧€鏂囦欢锛堜笉鍖呭惈鍚庣紑锛?/p>
uri_path()锛氱綉鍧€鏂囦欢璺緞锛堜笉鍖呭惈鏂囦欢鍚嶏級
url()锛氶殢鏈篣RL鍦板潃
user_name()锛氶殢鏈虹敤鎴峰悕
isbn10()锛氶殢鏈篒SBN锛?0浣嶏級
isbn13()锛氶殢鏈篒SBN锛?3浣嶏級
job()锛氶殢鏈鸿亴浣?/p>
paragraph()锛氶殢鏈虹敓鎴愪竴涓钀?/p>
paragraphs()锛氶殢鏈虹敓鎴愬涓钀斤紝閫氳繃鍙傛暟nb鏉ユ帶鍒舵钀芥暟锛岃繑鍥炴暟缁?/p>
sentence()锛氶殢鏈虹敓鎴愪竴鍙ヨ瘽
sentences()锛氶殢鏈虹敓鎴愬鍙ヨ瘽锛屼笌娈佃惤绫讳技
text()锛氶殢鏈虹敓鎴愪竴绡囨枃绔狅紙涓嶈骞绘兂鐫€浜哄伐鏅鸿兘浜嗭紝鑷充粖娌″畬鍏ㄧ湅鎳備竴鍙ヨ瘽鏄粈涔堟剰鎬濓級
word()锛氶殢鏈虹敓鎴愯瘝璇?/p>
words()锛氶殢鏈虹敓鎴愬涓瘝璇紝鐢ㄦ硶涓庢钀斤紝鍙ュ瓙锛岀被浼?/p>
binary()锛氶殢鏈虹敓鎴愪簩杩涘埗缂栫爜
boolean()锛歍rue/False
language_code()锛氶殢鏈虹敓鎴愪袱浣嶈瑷€缂栫爜
locale()锛氶殢鏈虹敓鎴愯瑷€/鍥介檯 淇℃伅
md5()锛氶殢鏈虹敓鎴怣D5
null_boolean()锛歂ULL/True/False
password()锛氶殢鏈虹敓鎴愬瘑鐮?鍙€夊弬鏁帮細length锛氬瘑鐮侀暱搴︼紱special_chars锛氭槸鍚﹁兘浣跨敤鐗规畩瀛楃锛沝igits锛氭槸鍚﹀寘鍚暟瀛楋紱upper_case锛氭槸鍚﹀寘鍚ぇ鍐欏瓧姣嶏紱lower_case锛氭槸鍚﹀寘鍚皬鍐欏瓧姣?/p>
sha1()锛氶殢鏈篠HA1
sha256()锛氶殢鏈篠HA256
uuid4()锛氶殢鏈篣UID
first_name()锛?/p>
first_name_female()锛氬コ鎬у悕
first_name_male()锛氱敺鎬у悕
first_romanized_name()锛氱綏椹悕
last_name()锛?/p>
last_name_female()锛氬コ濮?/p>
last_name_male()锛氱敺濮?/p>
last_romanized_name()锛?/p>
name()锛氶殢鏈虹敓鎴愬叏鍚?/p>
name_female()锛氱敺鎬у叏鍚?/p>
name_male()锛氬コ鎬у叏鍚?/p>
romanized_name()锛氱綏椹悕
msisdn()锛氱Щ鍔ㄥ彴鍥介檯鐢ㄦ埛璇嗗埆鐮侊紝鍗崇Щ鍔ㄧ敤鎴风殑ISDN鍙风爜
phone_number()锛氶殢鏈虹敓鎴愭墜鏈哄彿
phonenumber_prefix()锛氶殢鏈虹敓鎴愭墜鏈哄彿娈?/p>
profile()锛氶殢鏈虹敓鎴愭。妗堜俊鎭?/p>
simple_profile()锛氶殢鏈虹敓鎴愮畝鍗曟。妗堜俊鎭?/p>
3.4 闅忔満鐢熸垚鎸囧畾绫诲瀷鏁版嵁
pybool()锛氬竷灏旂被鍨?/p>
pydecimal()锛氭暟瀛?/p>
pydict()锛氬瓧鍏?/p>
pyfloat()锛歭eft_digits=5 #鐢熸垚鐨勬暣鏁颁綅鏁? right_digits=2 #鐢熸垚鐨勫皬鏁颁綅鏁? positive=True #鏄惁鍙湁姝f暟
pyint()锛氭暣鍨?/p>
pyiterable()锛氳凯浠e櫒
pylist()锛氬垪琛?/p>
pyset()锛氶泦鍚?/p>
pystr()锛氬瓧绗︿覆
pystruct()锛氱粨鏋勪綋
pytuple()锛氬厓缁?/p>
3.5 闅忔満鐢熸垚甯哥敤鏁版嵁
ssn()锛氱敓鎴愯韩浠借瘉鍙?/p>
chrome()锛氶殢鏈虹敓鎴怌hrome鐨勬祻瑙堝櫒user_agent淇℃伅
firefox()锛氶殢鏈虹敓鎴怓ireFox鐨勬祻瑙堝櫒user_agent淇℃伅
internet_explorer()锛氶殢鏈虹敓鎴怚E鐨勬祻瑙堝櫒user_agent淇℃伅
opera()锛氶殢鏈虹敓鎴怬pera鐨勬祻瑙堝櫒user_agent淇℃伅
safari()锛氶殢鏈虹敓鎴怱afari鐨勬祻瑙堝櫒user_agent淇℃伅
linux_platform_token()锛氶殢鏈篖inux淇℃伅
user_agent()锛氶殢鏈簎ser_agent淇℃伅
杞浇鍗氬 https://www.cnblogs.com/dream66/
以上是关于python妯″潡涓€涔媐aker妯″潡的主要内容,如果未能解决你的问题,请参考以下文章
re 妯″潡銆乼yping 妯″潡銆乧ollections 妯″潡
Python-鍩轰簬socket鍜宻elect妯″潡瀹炵幇IO澶氳矾澶嶇敤