Locale fr_CH

faker.providers.address

class faker.providers.address.fr_CH.Provider(generator: Any)

Bases: Provider

address() str
示例:

‘791 Crist Parks, Sashabury, IL 86039-9874’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.address()
...
'chemin Paschoud 56\n8593 Broquet-sur-Curdy'
'chemin de Privet\n3411 Fonjallaz (SG)'
'chemin Olivier Rey 97\n5080 Julliard'
'chemin Roland Evéquoz 4\n4328 Boechat-près-Beurret'
'rue Camille Rey 91\n6839 Saudan-sur-de Dardel'
administrative_unit() str

Randomly returns a Swiss canton name. :example: ‘Vaud’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.administrative_unit()
...
'Neuchâtel'
'Zoug'
'Nidwald'
'Appenzell Rhodes-Intérieures'
'Glaris'
building_number() str
示例:

‘791’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.building_number()
...
'16'
'88'
'84'
'49'
'324'
canton() Tuple[str, str]

Randomly returns a swiss canton (‘Abbreviated’ , ‘Name’). :example: (‘VD’ . ‘Vaud’)

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.canton()
...
('NE', 'Neuchâtel')
('ZG', 'Zoug')
('NW', 'Nidwald')
('AI', 'Appenzell Rhodes-Intérieures')
('GL', 'Glaris')
canton_code() str

Randomly returns a Swiss canton code. :example: ‘VD’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.canton_code()
...
'NE'
'ZG'
'NW'
'AI'
'GL'
canton_name() str

Randomly returns a Swiss canton name. :example: ‘Vaud’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.canton_name()
...
'Neuchâtel'
'Zoug'
'Nidwald'
'Appenzell Rhodes-Intérieures'
'Glaris'
city() str
示例:

‘Sashabury’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.city()
...
'Masseron-des-Bois'
'Paschoud am Albis'
'Diesbach am Albis'
'Sansonnens-Dessus'
'Broquet-sur-Curdy'
city_prefix() str
示例:

‘rue’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.city_prefix()
...
'Ober'
'Ober'
'Saint '
'San '
'Unter'
city_suffix() str
示例:

‘town’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.city_suffix()
...
' am See'
' am See'
'-des-Bois'
'-Dessous'
' an der Aare'
country() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.country()
...
'Tonga'
'Iran'
'Slovénie'
'Venezuela'
'Kenya'
country_code(representation: str = 'alpha-2') str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.country_code()
...
'MV'
'PS'
'NL'
'BB'
'IL'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.country_code(representation='alpha-2')
...
'MV'
'PS'
'NL'
'BB'
'IL'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.country_code(representation='alpha-3')
...
'MDV'
'PSE'
'NLD'
'BRB'
'ISR'
current_country() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.current_country()
...
'Switzerland'
'Switzerland'
'Switzerland'
'Switzerland'
'Switzerland'
current_country_code() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.current_country_code()
...
'CH'
'CH'
'CH'
'CH'
'CH'
postcode() str
示例:

86039-9874

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.postcode()
...
'7604'
'9764'
'8593'
'9242'
'2948'
street_address() str
示例:

‘791 Crist Parks’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.street_address()
...
'rue Sébastien Paschoud 56'
'boulevard Paul Pachoud 34'
'chemin de Privet'
'rue de Dubey 2'
'avenue Vanessa Boillat 66'
street_name() str
示例:

‘Crist Parks’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.street_name()
...
'avenue Christophe Cossy'
'avenue de Maire'
'avenue Eliane Sansonnens'
'boulevard Broquet'
'rue Henri Vienne'
street_prefix() str
示例:

‘rue’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.street_prefix()
...
'avenue'
'avenue'
'rue'
'chemin'
'boulevard'
street_suffix() str
示例:

‘Avenue’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.street_suffix()
...
'Street'
'Street'
'Street'
'Street'
'Street'

faker.providers.bank

class faker.providers.bank.fr_CH.Provider(generator: Any)

Bases: Provider

Implement bank provider for fr_CH locale.

There is no difference from the de_CH implementation.

aba() str

Generate an ABA routing transit number.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.aba()
...
'076048766'
'057593829'
'052194896'
'034115783'
'025659384'
bank() str

Generate a bank name.

bank_country() str

Generate the bank provider’s ISO 3166-1 alpha-2 country code.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.bank_country()
...
'CH'
'CH'
'CH'
'CH'
'CH'
bban() str

Generate a Basic Bank Account Number (BBAN).

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.bban()
...
'66048764759382421'
'94892411578156593'
'87784080160975351'
'39332871158714841'
'85839894719659342'
iban() str

Generate an International Bank Account Number (IBAN).

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.iban()
...
'CH8566048764759382421'
'CH1694892411578156593'
'CH2487784080160975351'
'CH3639332871158714841'
'CH3285839894719659342'
swift(length: int | None = None, primary: bool = False, use_dataset: bool = False) str

Generate a SWIFT code.

SWIFT codes, reading from left to right, are composed of a 4 alphabet character bank code, a 2 alphabet character country code, a 2 alphanumeric location code, and an optional 3 alphanumeric branch code. This means SWIFT codes can only have 8 or 11 characters, so the value of length can only be None or the integers 8 or 11. If the value is None, then a value of 8 or 11 will randomly be assigned.

Because all 8-digit SWIFT codes already refer to the primary branch or office, the primary argument only has an effect if the value of length is 11. If primary is True and length is 11, the 11-digit SWIFT codes generated will always end in 'XXX' to denote that they belong to primary branches/offices.

For extra authenticity, localized providers may opt to include SWIFT bank codes, location codes, and branch codes used in their respective locales. If use_dataset is True, this method will generate SWIFT codes based on those locale-specific codes if included. If those codes were not included, then it will behave as if use_dataset were False, and in that mode, all those codes will just be randomly generated as per the specification.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift()
...
'YNBICH65ZT4'
'SGQECHSIGQ8'
'JDXCCHV4'
'LNKTCHN9'
'OQIBCH9AFZA'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift(length=8)
...
'MYNBCHQ6'
'PMZJCH4W'
'SGQECHSI'
'YDTZCHQ8'
'WZTECHTG'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift(length=8, use_dataset=True)
...
'MYNBCHQ6'
'PMZJCH4W'
'SGQECHSI'
'YDTZCHQ8'
'WZTECHTG'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift(length=11)
...
'MYNBCHQ65ZT'
'PLSGCH6ISIG'
'TZIRCHJTGEV'
'PRDLCH1UN94'
'OQIBCH9AFZA'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift(length=11, primary=True)
...
'MYNBCHQ6XXX'
'PMZJCH4WXXX'
'SGQECHSIXXX'
'YDTZCHQ8XXX'
'WZTECHTGXXX'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift(length=11, use_dataset=True)
...
'MYNBCHQ65ZT'
'PLSGCH6ISIG'
'TZIRCHJTGEV'
'PRDLCH1UN94'
'OQIBCH9AFZA'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift(length=11, primary=True, use_dataset=True)
...
'MYNBCHQ6XXX'
'PMZJCH4WXXX'
'SGQECHSIXXX'
'YDTZCHQ8XXX'
'WZTECHTGXXX'
swift11(primary: bool = False, use_dataset: bool = False) str

Generate an 11-digit SWIFT code.

This method uses swift() under the hood with the length argument set to 11. If primary is set to True, the SWIFT code will always end with 'XXX'. All 11-digit SWIFT codes use this convention to refer to the primary branch/office.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift11()
...
'MYNBCHQ65ZT'
'PLSGCH6ISIG'
'TZIRCHJTGEV'
'PRDLCH1UN94'
'OQIBCH9AFZA'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift11(use_dataset=True)
...
'MYNBCHQ65ZT'
'PLSGCH6ISIG'
'TZIRCHJTGEV'
'PRDLCH1UN94'
'OQIBCH9AFZA'
swift8(use_dataset: bool = False) str

Generate an 8-digit SWIFT code.

This method uses swift() under the hood with the length argument set to 8 and with the primary argument omitted. All 8-digit SWIFT codes already refer to the primary branch/office.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift8()
...
'MYNBCHQ6'
'PMZJCH4W'
'SGQECHSI'
'YDTZCHQ8'
'WZTECHTG'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.swift8(use_dataset=True)
...
'MYNBCHQ6'
'PMZJCH4W'
'SGQECHSI'
'YDTZCHQ8'
'WZTECHTG'

faker.providers.company

class faker.providers.company.fr_CH.Provider(generator: Any)

Bases: Provider

ape_code(version: str | None = 'naf-2003') str

Generate an APE code (also known as NAF code). It identify french company main branch of activity.

It provide numbers from nomenclature version naf-2003 (default) or naf-2025. To have it generate a truly random (and possibly invalid number) set version to None

参数:

version – Set to "naf-2003" to return a valid NAF 2003 APE code.

Set to "naf-2025" to return a valid NAF 2025 APE code. Set to None to return a truly random and possibly invalid number Defaults to "naf-2003" :param letter: Force letter :param siren: Force SIREN

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ape_code()
...
'46.32C'
'46.75Z'
'06.10Z'
'28.49Z'
'56.29B'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ape_code(version="naf-2003")
...
'46.32C'
'46.75Z'
'06.10Z'
'28.49Z'
'56.29B'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ape_code(version="naf-2025")
...
'46.46Y'
'47.22Y'
'05.10Y'
'29.20Y'
'58.13Y'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ape_code(version=None)
...
'66.04Q'
'76.47L'
'93.82J'
'21.94R'
'92.41X'
bs() str
示例:

‘integrate extensible convergence’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.bs()
...
'iterate integrated e-markets'
'integrate back-end mindshare'
'synthesize wireless content'
'syndicate synergistic applications'
'productize killer mindshare'
catch_phrase() str
示例:

‘integrate extensible convergence’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.catch_phrase()
...
'Le pouvoir de rouler en toute tranquilité'
"Le pouvoir d'innover naturellement"
"L'avantage de changer à la pointe"
"L'assurance d'évoluer de manière sûre"
"L'avantage d'innover à la pointe"
catch_phrase_attribute() str

Returns a random catch phrase attribute.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.catch_phrase_attribute()
...
'en toute sécurité'
'autrement'
'de manière sûre'
'autrement'
'de manière efficace'
catch_phrase_noun() str

Returns a random catch phrase noun.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.catch_phrase_noun()
...
'le pouvoir'
'le pouvoir'
'la sécurité'
"l'assurance"
'la possibilité'
catch_phrase_verb() str

Returns a random catch phrase verb.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.catch_phrase_verb()
...
"d'atteindre vos buts"
"d'atteindre vos buts"
'de rouler'
"d'innover"
'de concrétiser vos projets'
company() str
示例:

‘Acme Ltd’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.company()
...
'Masseron'
'Cossy Sàrl.'
'Diesbach'
'Grand'
'Pachoud Broquet Sàrl.'
company_suffix() str
示例:

‘Ltd’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.company_suffix()
...
'Sàrl.'
'Sàrl.'
'SA'
'Sàrl.'
'Sàrl.'
company_vat(siren: str = '') str

Generate a valid TVA (French VAT) number. It is the concatenation of “FR”, siren checksum and siren number

参数:

siren – Force SIREN number

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.company_vat()
...
'FR 09 660 487 646'
'FR 55 759 382 427'
'FR 42 194 892 410'
'FR 65 157 815 655'
'FR 73 938 778 404'
>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.company_vat(siren="123 456 789")
...
'FR 32 123 456 789'
'FR 32 123 456 789'
'FR 32 123 456 789'
'FR 32 123 456 789'
'FR 32 123 456 789'
ide() str

Generates a IDE number (9 digits). http://www.bfs.admin.ch/bfs/portal/fr/index/themen/00/05/blank/03/02.html

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ide()
...
'CHE-690.243.519'
'CHE-753.412.801'
'CHE-942.705.619'
'CHE-815.324.971'
'CHE-794.086.521'
idi() str

Generates a IDE number (9 digits). http://www.bfs.admin.ch/bfs/portal/fr/index/themen/00/05/blank/03/02.html

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.idi()
...
'CHE-690.243.519'
'CHE-753.412.801'
'CHE-942.705.619'
'CHE-815.324.971'
'CHE-794.086.521'
siren() str

Generates a siren number (9 digits). Formatted as ‘### ### ###’.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.siren()
...
'660 487 646'
'759 382 427'
'194 892 410'
'157 815 655'
'938 778 404'
siret(max_sequential_digits: int = 2) str

Generates a siret number (14 digits). It is in fact the result of the concatenation of a siren number (9 digits), a sequential number (4 digits) and a control number (1 digit) concatenation. If $max_sequential_digits is invalid, it is set to 2.

The siret number is formatted as ‘### ### ### #####’. :param max_sequential_digits The maximum number of digits for the sequential number (> 0 && <= 4).

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.siret()
...
'604 876 474 00494'
'938 242 195 00452'
'892 411 570 00328'
'156 593 873 00714'
'840 801 609 00560'
uid() str

Generates a IDE number (9 digits). http://www.bfs.admin.ch/bfs/portal/fr/index/themen/00/05/blank/03/02.html

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.uid()
...
'CHE-690.243.519'
'CHE-753.412.801'
'CHE-942.705.619'
'CHE-815.324.971'
'CHE-794.086.521'

faker.providers.internet

class faker.providers.internet.fr_CH.Provider(generator: Any)

Bases: Provider

ascii_company_email() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ascii_company_email()
...
'cmasseron@paschoud.ch'
'ediesbach@sansonnens.net'
'aliciabroquet@vienne.com'
'hugo15@robert.com'
'laura59@rey.org'
ascii_email() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ascii_email()
...
'qbarman@vtxnet.ch'
'marianne59@bluewin.ch'
'louis19@privet.com'
'beuchatchristine@vtxnet.ch'
'laura59@rey.org'
ascii_free_email() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ascii_free_email()
...
'cmasseron@romandie.com'
'ymaire@romandie.com'
'lgrand@bluewin.ch'
'aliciabroquet@hotmail.fr'
'simone92@romandie.com'
ascii_safe_email() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ascii_safe_email()
...
'cmasseron@example.com'
'ymaire@example.com'
'lgrand@example.org'
'aliciabroquet@example.org'
'simone92@example.com'
company_email() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.company_email()
...
'cmasseron@paschoud.ch'
'ediesbach@sansonnens.net'
'aliciabroquet@vienne.com'
'hugo15@robert.com'
'laura59@rey.org'
dga(year: int | None = None, month: int | None = None, day: int | None = None, tld: str | None = None, length: int | None = None) str

Generates a domain name by given date https://en.wikipedia.org/wiki/Domain_generation_algorithm

Return type:

str

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.dga()
...
'hxqvaffcmfsccynscisxeajjagjahtnfcmfsccynscisxeajjagjahtnfcmfscc.org'
'meydkrgdcvulautulqvjofrrnbjkfmvrewtpfttqcjafdhxckmyfamohcpnldug.org'
'iiulfpgbvqcdaehnqkbxmaqgkykorlxnwy.net'
'cpyhexmtvewxpwiiaxtgdfajuhbsyaaykvgkgreki.com'
'uqniukqjckmjabijnuqho.com'
domain_name(levels: int = 1) str

Produce an Internet domain name with the specified number of subdomain levels.

>>> domain_name()
nichols-phillips.com
>>> domain_name(2)
williamson-hopkins.jackson.com
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.domain_name()
...
'masseron.com'
'paschoud.ch'
'diesbach.ch'
'sansonnens.net'
'curdy.org'
domain_word() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.domain_word()
...
'masseron'
'cossy'
'diesbach'
'grand'
'pachoud'
email(safe: bool = True, domain: str | None = None) str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.email()
...
'cmasseron@example.com'
'ymaire@example.com'
'lgrand@example.org'
'aliciabroquet@example.org'
'simone92@example.com'
free_email() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.free_email()
...
'cmasseron@romandie.com'
'ymaire@romandie.com'
'lgrand@bluewin.ch'
'aliciabroquet@hotmail.fr'
'simone92@romandie.com'
free_email_domain() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.free_email_domain()
...
'sunrise.ch'
'sunrise.ch'
'gmail.com'
'romandie.com'
'vtxnet.ch'
hostname(levels: int = 1) str

Produce a hostname with specified number of subdomain levels.

>>> hostname()
db-01.nichols-phillips.com
>>> hostname(0)
laptop-56
>>> hostname(2)
web-12.williamson-hopkins.jackson.com
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.hostname()
...
'web-66.cossy.ch'
'web-47.sansonnens.net'
'lt-24.boichat.com'
'desktop-11.mottet.com'
'desktop-65.rey.org'
http_method() str

Returns random HTTP method https://mdn.org.cn/en-US/docs/Web/HTTP/Methods

Return type:

str

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.http_method()
...
'OPTIONS'
'OPTIONS'
'GET'
'DELETE'
'PATCH'
http_status_code(include_unassigned: bool = True) int

Returns random HTTP status code https://www.rfc-editor.org/rfc/rfc9110#name-status-codes :param include_unassigned: Whether to include status codes which have

not yet been assigned or are unused

Returns:

a random three digit status code

Return type:

int

示例:

404

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.http_status_code()
...
532
297
488
555
315
iana_id() str

Returns IANA Registrar ID https://www.iana.org/assignments/registrar-ids/registrar-ids.xhtml

Return type:

str

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.iana_id()
...
'6463344'
'7056021'
'679216'
'4343903'
'8577767'
image_url(width: int | None = None, height: int | None = None, placeholder_url: str | None = None) str

Returns URL to placeholder image Example: http://placehold.it/640x480

参数:
  • width – Optional image width

  • height – Optional image height

  • placeholder_url – Optional template string of image URLs from custom placeholder service. String must contain {width} and {height} placeholders, eg: https:/example.com/{width}/{height}.

Return type:

str

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.image_url()
...
'https://picsum.photos/788/861'
'https://dummyimage.com/530x995'
'https://dummyimage.com/621x976'
'https://dummyimage.com/447x285'
'https://placekitten.com/286/194'
ipv4(network: bool = False, address_class: str | None = None, private: str | None = None) str

Returns a random IPv4 address or network with a valid CIDR.

参数:
  • network – Network address

  • address_class – IPv4 address class (a, b, or c)

  • private – Public or private

Returns:

IPv4

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ipv4()
...
'171.174.170.81'
'95.25.112.121'
'51.105.121.194'
'195.110.164.126'
'141.250.247.54'
ipv4_network_class() str

Returns a IPv4 network class ‘a’, ‘b’ or ‘c’.

Returns:

IPv4 network class

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ipv4_network_class()
...
'b'
'b'
'a'
'b'
'c'
ipv4_private(network: bool = False, address_class: str | None = None) str

Returns a private IPv4.

参数:
  • network – Network address

  • address_class – IPv4 address class (a, b, or c)

Returns:

Private IPv4

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ipv4_private()
...
'172.29.117.82'
'10.248.203.131'
'172.25.180.188'
'172.22.253.123'
'192.168.71.140'
ipv4_public(network: bool = False, address_class: str | None = None) str

Returns a public IPv4 excluding private blocks.

参数:
  • network – Network address

  • address_class – IPv4 address class (a, b, or c)

Returns:

Public IPv4

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ipv4_public()
...
'166.186.169.69'
'111.198.92.30'
'168.155.75.206'
'141.250.247.54'
'212.120.204.37'
ipv6(network: bool = False) str

Produce a random IPv6 address or network with a valid CIDR

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ipv6()
...
'e3e7:682:c209:4cac:629f:6fbf:d82c:7cd'
'f728:b4fa:4248:5e3a:a5d:2f35:6baa:9455'
'eb11:67b3:67a9:c378:7c65:c1e6:82e2:e662'
'f7c1:bd87:4da5:e709:d471:3d61:c8a7:639'
'e443:df78:9558:867f:5ba9:1fb0:7a02:4204'
mac_address(multicast: bool = False) str

Returns a random MAC address.

参数:

multicast – Multicast address

Returns:

MAC Address

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.mac_address()
...
'66:c5:d7:14:84:f8'
'48:9b:f4:b7:6f:47'
'18:47:30:80:4b:9e'
'6e:25:a9:f1:33:b5'
'0e:a1:68:f4:e2:85'
nic_handle(suffix: str = 'FAKE') str

Returns NIC Handle ID https://www.apnic.net/manage-ip/using-whois/guide/person/

Return type:

str

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.nic_handle()
...
'ZYT1598-FAKE'
'SIW493-FAKE'
'UE59352-FAKE'
'WBUN892-FAKE'
'CHQD98-FAKE'
nic_handles(count: int = 1, suffix: str = '????') List[str]

Returns NIC Handle ID list

Return type:

list[str]

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.nic_handles()
...
['ZYT1598-EWLN']
['WGNZ53-QITZ']
['UERV52-EJGW']
['CHQ498-DZJA']
['UU1864-TEMK']
port_number(is_system: bool = False, is_user: bool = False, is_dynamic: bool = False) int

Returns a network port number https://tools.ietf.org/html/rfc6335

参数:
  • is_system – System or well-known ports

  • is_user – User or registered ports

  • is_dynamic – Dynamic / private / ephemeral ports

Return type:

int

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.port_number()
...
50494
55125
5306
33936
63691
ripe_id() str

Returns RIPE Organization ID https://www.ripe.net/manage-ips-and-asns/db/support/organisation-object-in-the-ripe-database

Return type:

str

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ripe_id()
...
'ORG-ZYT1598-RIPE'
'ORG-SIW493-RIPE'
'ORG-UE59352-RIPE'
'ORG-WBUN892-RIPE'
'ORG-CHQD98-RIPE'
safe_domain_name() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.safe_domain_name()
...
'example.com'
'example.com'
'example.org'
'example.com'
'example.net'
safe_email() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.safe_email()
...
'cmasseron@example.com'
'ymaire@example.com'
'lgrand@example.org'
'aliciabroquet@example.org'
'simone92@example.com'
slug(value: str | None = None) str

Django algorithm

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.slug()
...
'three-image-son'
'kitchen-amount'
'much-mention'
'why-step-themselves'
'me-help-past-wait'
tld() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.tld()
...
'ch'
'ch'
'com'
'org'
'ch'
uri(schemes: List[str] | None = None, deep: int | None = None) str
参数:
  • schemes – a list of strings to use as schemes, one will chosen randomly. If None, it will generate http and https uris. Passing an empty list will result in schemeless uri generation like “://domain.com/index.html”.

  • deep – an integer specifying how many path components the URI should have..

Returns:

a random url string.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.uri()
...
'https://diesbach.ch/categorylogin.jsp'
'https://www.dubey.ch/main/main/mainprivacy.htm'
'https://www.monnard.org/tag/tagsmain.asp'
'http://www.vallelian.ch/exploreauthor.php'
'http://boechat.com/list/wp-content/categoriesmain.html'
uri_extension() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.uri_extension()
...
'.php'
'.php'
'.html'
'.htm'
'.asp'
uri_page() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.uri_page()
...
'author'
'category'
'privacy'
'category'
'index'
uri_path(deep: int | None = None) str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.uri_path()
...
'posts/tag'
'explore/tag'
'explore/category'
'blog'
'category'
url(schemes: List[str] | None = None) str
参数:

schemes – a list of strings to use as schemes, one will chosen randomly. If None, it will generate http and https urls. Passing an empty list will result in schemeless url generation like “://domain.com”.

Returns:

a random url string.

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.url()
...
'https://cossy.ch/'
'https://sansonnens.net/'
'http://boichat.com/'
'https://www.fonjallaz.com/'
'https://vallelian.net/'
user_name() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.user_name()
...
'cmasseron'
'odette76'
'marianne59'
'nicolebroquet'
'louis19'

faker.providers.job

class faker.providers.job.fr_CH.Provider(generator: Any)

Bases: Provider

job() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.job()
...
'Expert-comptable diplômé'
'Technicien du film avec brevet fédéral'
"Gestionnaire d'entreprise diplômé secteur automobile"
'Aide-mouleur AFP'
'Dessinateur-constructeur industriel CFC'
job_female() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.job_female()
...
'Expert-comptable diplômé'
'Technicien du film avec brevet fédéral'
"Gestionnaire d'entreprise diplômé secteur automobile"
'Aide-mouleur AFP'
'Dessinateur-constructeur industriel CFC'
job_male() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.job_male()
...
'Expert-comptable diplômé'
'Technicien du film avec brevet fédéral'
"Gestionnaire d'entreprise diplômé secteur automobile"
'Aide-mouleur AFP'
'Dessinateur-constructeur industriel CFC'

faker.providers.person

class faker.providers.person.fr_CH.Provider(generator: Any)

Bases: Provider

first_name() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.first_name()
...
'Fabienne'
'Josiane'
'Christophe'
'Sébastien'
'Odette'
first_name_female() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.first_name_female()
...
'Marguerite'
'Mathilde'
'Aurélie'
'Jacqueline'
'Simone'
first_name_male() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.first_name_male()
...
'Nicolas'
'Pascal'
'Arthur'
'Kevin'
'Stéphane'
first_name_nonbinary() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.first_name_nonbinary()
...
'Fabienne'
'Josiane'
'Christophe'
'Sébastien'
'Odette'
language_name() str

生成一个随机的 i18n 语言名称(例如 English)。

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.language_name()
...
'Luba-Katanga'
'Malay'
'Aymara'
'Interlingue'
'Quechua'
last_name() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.last_name()
...
'Jacot-Guillarmod'
'Masseron'
'Barman'
'Cossy'
'Paschoud'
last_name_female() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.last_name_female()
...
'Jacot-Guillarmod'
'Masseron'
'Barman'
'Cossy'
'Paschoud'
last_name_male() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.last_name_male()
...
'Jacot-Guillarmod'
'Masseron'
'Barman'
'Cossy'
'Paschoud'
last_name_nonbinary() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.last_name_nonbinary()
...
'Jacot-Guillarmod'
'Masseron'
'Barman'
'Cossy'
'Paschoud'
name() str
示例:

‘John Doe’

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.name()
...
'Marguerite Masseron-Barman'
'Stéphane Müller'
'Lucas Muriset-Grand'
'Fabienne Pachoud'
'Loïc Broquet'
name_female() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.name_female()
...
'Marguerite Masseron-Barman'
'Simone Müller'
'Laetitia Muriset'
'Yvette Comman'
'Céline Curdy'
name_male() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.name_male()
...
'Nicolas Masseron-Barman'
'Stéphane Müller'
'Lucas Muriset'
'Jean Pachoud'
'Loïc Broquet'
name_nonbinary() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.name_nonbinary()
...
'Marguerite Masseron-Barman'
'Stéphane Müller'
'Lucas Muriset-Grand'
'Fabienne Pachoud'
'Loïc Broquet'
prefix() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.prefix()
...
''
''
''
''
''
prefix_female() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.prefix_female()
...
''
''
''
''
''
prefix_male() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.prefix_male()
...
''
''
''
''
''
prefix_nonbinary() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.prefix_nonbinary()
...
''
''
''
''
''
suffix() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.suffix()
...
''
''
''
''
''
suffix_female() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.suffix_female()
...
''
''
''
''
''
suffix_male() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.suffix_male()
...
''
''
''
''
''
suffix_nonbinary() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.suffix_nonbinary()
...
''
''
''
''
''

faker.providers.phone_number

class faker.providers.phone_number.fr_CH.Provider(generator: Any)

基类: Provider

country_calling_code() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.country_calling_code()
...
'+687'
'+595'
'+880'
'+964'
'+41'
msisdn() str

https://en.wikipedia.org/wiki/MSISDN

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.msisdn()
...
'6048764759382'
'2194892411578'
'5659387784080'
'6097535139332'
'1158714841858'
phone_number() str
示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.phone_number()
...
'0901 660 487'
'+41 (0)64 759 38 24'
'+41 61 948 92 41'
'091 578 15 65'
'053 877 84 08'

faker.providers.ssn

class faker.providers.ssn.fr_CH.Provider(generator: Any)

Bases: Provider

ssn() str
Returns a 13 digits Swiss SSN named AHV (German) or

AVS (French and Italian) See: http://www.bsv.admin.ch/themen/ahv/00011/02185/

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.ssn()
...
'756.6902.4351.88'
'756.5327.1068.40'
'756.4186.5239.04'
'756.5694.7138.25'
'756.0897.5362.19'
vat_id() str
Returns:

Swiss UID number

示例:

>>> Faker.seed(0)
>>> for _ in range(5):
...     fake.vat_id()
...
'CHE660487649'
'CHE759382428'
'CHE194892412'
'CHE157815650'
'CHE938778409'