Skip to main content

產生隨機英文名稱或英文名稱的中文翻譯

Project description

SampleName

PyPI PyPI - Downloads GitHub Workflow Status (with event)

產生隨機英文名稱或英文名稱的中文翻譯, 寫範例程式時可以用

名稱清單

Install

pip install SampleName

Methods

  • listCustom() - 從自訂清單隨機挑選不重複的
  • listNameEng() - 隨機取得男生/女生英文名字
  • listNameCht() - 隨機取得男生/女生英文名字翻譯
  • listMaleNameEng() - 隨機取得男生英文名稱
  • listMaleNameCht() - 隨機取得男生英文名字翻譯
  • listFemaleNameEng() - 隨機取得女生英文名字
  • listFemaleNameCht() - 隨機取得女生英文名字翻譯

Using

建立物件

from sampleName import SampleName
smapleName = SampleName()

隨機取出 8 筆名稱 (預設 8 筆)

# 取出隨機男性/女性 英文 名稱
nameList = smapleName.listNameEng()
print(nameList)
# ['Kate', 'Cedric', 'Adrian', 'Yuri', 'Lara', 'Mildred', 'Craig', 'Oswald']

# 取出隨機男性/女性 中文 名稱
nameList = smapleName.listNameCht()
print(nameList)
# ['海頓', '藍道夫', '吉羅德', '妮可拉', '阿爾瓦', '比尤萊', '伊蒂絲', '珀莉']

隨機取出自訂筆數名稱

# 取出 4 筆女性英文名稱
nameList = smapleName.listFemaleNameEng(4)
print(nameList)
# ['Elizabeth', 'Irene', 'Candice', 'Myra']

# 取出 5 筆男性英文名稱翻譯
nameList = smapleName.listMaleNameCht(5)
print(nameList)
# ['班森', '愛格伯特', '扎威爾', '凱利', '菲力克斯']

從自訂清單內取得隨機名稱

nameList = ["愛爾默", "妮可拉", "特麗莎布藍達", "伯頓", "若娜"]
smapleName = SampleName(l)
nameList = smapleName.listCustom(2)
print(nameList)
# ['特麗莎布藍達', '愛爾默']

載入自訂名稱檔案

# nameList.json 內容
# ["愛爾默", "妮可拉", "特麗莎布藍達", "伯頓", "若娜"]
nameFile = 'nameList.json'
smapleName = SampleName(nameFile)
nameList = smapleName.listCustom(2)
print(nameList)
# ['妮可拉', '愛爾默']

Development

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SampleName-0.1.0.tar.gz (16.0 kB view hashes)

Uploaded Source

Built Distribution

SampleName-0.1.0-py3-none-any.whl (16.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page