Coder Social home page Coder Social logo

samplename's Introduction

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

samplename's People

Contributors

8loser avatar

Watchers

 avatar  avatar

samplename's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.