python- parameterization - (1) (phone number)

A. Generating a phone number, and where no classes or functions written in the form, the code is

import random

# Top three specified phone number format, and returns a random code, the relevant section about themselves about a parameterized random
type_mobile = [ '138', ' 139', '158', '180', '188', '189' ]
type_phone = The random.choice (type_mobile)

# Randomly generates an 8-bit range of 0-9
number_phone = '' .join (random.sample ( '0123456789', 8))

# Generate a phone number

mobile_phone=type_phone+number_phone

print(mobile_phone)

 

 

 

 

 

Guess you like

Origin www.cnblogs.com/newsss/p/12057755.html