Skip to content

Instantly share code, notes, and snippets.

@wtberry
Created July 7, 2019 03:15
Show Gist options
  • Save wtberry/c3b91ac6018e4b552963c05eb5e6dd95 to your computer and use it in GitHub Desktop.
Save wtberry/c3b91ac6018e4b552963c05eb5e6dd95 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"\n",
"ja_JP Fake Names: \n",
"中津川 真綾\n",
"山本 和也\n",
"工藤 春香\n",
"中津川 和也\n",
"鈴木 陽一\n",
"\n",
"en_US Fake Names: \n",
"Jonathan Gilbert\n",
"Wanda Nelson\n",
"Mr. John Dixon\n",
"Andre Vang\n",
"Erin Moore\n"
]
}
],
"source": [
"from faker import Faker\n",
"\n",
"def generate_name(country, num=5):\n",
" fake = Faker(country) # initialize the faker instance for chosen country\n",
" print('\\n{} Fake Names: '.format(country))\n",
" for i in range(num): print(fake.name()) # just to save line, don't code like this.\n",
"\n",
"generate_name('ja_JP')\n",
"generate_name('en_US')"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.8"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment