溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點(diǎn)擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何快速掌握Vue3企業(yè)實(shí)際應(yīng)用

發(fā)布時(shí)間:2021-10-14 14:35:24 來源:億速云 閱讀:133 作者:iii 欄目:編程語言

這篇文章主要講解了“如何快速掌握Vue3企業(yè)實(shí)際應(yīng)用”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“如何快速掌握Vue3企業(yè)實(shí)際應(yīng)用”吧!

了解TS基礎(chǔ)語法
1 import random
2 if name =="main": #四位數(shù)字字母考證碼的生成
3 checkcode="" #保管考證碼的變量
4 for i in range(4):
5 index=random.randrange(0,4) #生成一個(gè)0~3中的數(shù)
6 if index!=i and index +1 !=i:
7 checkcode +=chr(random.randint(97,122)) # 生成a~z中的一個(gè)小寫字母
8 elif index +1==i:
9 checkcode +=chr(random.randint(65,90) ) # 生成A~Z中的一個(gè)大寫字母
10 else:
11 checkcode +=str(random.randint(1,9)) # 數(shù)字1-9
12 print(checkcode)
復(fù)製代碼
輸出爲(wèi):m47A、8wQ9、vugS


2。格式化時(shí)間函數(shù)

1 def formatTime(longtime):
2 '''格式化時(shí)間的函數(shù)'''
3 import time
4 return time.strftime("%Y-%m-%d %H:%M:%S",time.localtime(longtime))

3。記載顯現(xiàn)登錄日誌實(shí)例

復(fù)製代碼
import time
def show_info():
print('''輸入提示數(shù)字,執(zhí)行相應(yīng)操作
0:退出
1:查看登錄日誌
''')
def write_loginfo(username):
"""
將用戶名和登錄時(shí)間寫入日誌
:param username: 用戶名
"""
with open('log.txt','a') as f:
string = "用戶名:{} 登錄時(shí)間:{}\n".format(username ,time.strftime('%Y-%m-%d %H:%M:%S',time.localtime(time.time())))
f.write(string)
def read_loginfo():
"""
讀取日誌
"""
with open('log.txt','r') as f:
while True:
line = f.readline()
if line == '':
break # 跳出循環(huán)
print(line) # 輸出一行內(nèi)容
if name == "main":

輸入用戶名

username = input('請輸入用戶名:')
# 檢測用戶名
while len(username) < 2 :
    print('用戶名長度應(yīng)不少於2位')
    username = input('請輸入用戶名:')
# 輸入密碼
password = input('請輸入密碼:')
# 檢測密碼
while len(passw ord) < 6 :
    print('密碼長度應(yīng)不少於6位')
    password = input('請輸入密碼:')
print('登錄勝利')
write_loginfo(username)  # 寫入日誌
show_info()              # 提示信息
num = int(input('輸入操作數(shù)字:')) # 輸入數(shù)字
while True:
    if num == 0:
        print('退出勝利')
        break
    elif num == 1:
        print('查看登錄日誌')
        read_loginfo()
        show_info()
        num = int(input('輸入操作數(shù)字:'))
    else:
        print('您輸入的數(shù)字有誤')
        show_info()
        num = int(input('輸入操作數(shù)字:'))

3。模仿淘寶客服自動(dòng)回復(fù)
復(fù)製代碼
1 # 任務(wù)2:模仿淘寶客服自動(dòng)回復(fù)
2
3 def find_answer(question):
4 with open('reply.txt','r') as f :
5 while True:
6 line=f.readline()
7 if not line: #也能夠爲(wèi)if line==''
8 break
9 keyword=line.split('|')[0]
10 reply=line.split('|')[1]
11 if keyword in question:
12 return reply
13 return '對不起,沒有妳想要找的問題'
14
15 if name =='main':
16 question=input('請輸入想要發(fā)問的內(nèi)容:')
17 while True:
18 if question=='bye':
19 break
20 reply=find_answer(question)
21 if not reply:
22 question=input("小蜜不懂您在說什麼,您能夠問一些與訂單、賬戶和支付相關(guān)的內(nèi)容(退出請輸入bye):")
23 else:
24 print(reply)
25 question=input("您能夠問一些與訂單、賬戶和支付相關(guān)的內(nèi)容(退出請輸入bye):")
26 print('謝謝,再見!')
27
復(fù)製代碼
復(fù)製代碼
4。求最大條約數(shù)和最小公倍數(shù) (輾轉(zhuǎn)相除法)
最大條約數(shù):指兩個(gè)或多個(gè)整數(shù)共有約數(shù)中最大的一個(gè)

最小公倍數(shù):兩個(gè)或多個(gè)整數(shù)公有的倍數(shù)叫做它們的公倍數(shù),其中除0以外最小的一個(gè)公倍數(shù)就叫做這幾個(gè)整數(shù)的最小公倍數(shù)

二者關(guān)係:兩個(gè)數(shù)之積=最小公倍數(shù)*最大條約數(shù)

復(fù)製代碼
1 a=int(input('輸入數(shù)字1:'))
2 b=int(input('輸入數(shù)字2:'))
3 s=a*b
4 while a%b!=0:
5 a,b=b,(a%b)
6 print(a)
7 print(b)
8 else:
9 print(b,'is the maximum common divisor最大條約數(shù)')
10 print(s//b,'is the least common multiple,最小公倍數(shù)')

感謝各位的閱讀,以上就是“如何快速掌握Vue3企業(yè)實(shí)際應(yīng)用”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對如何快速掌握Vue3企業(yè)實(shí)際應(yīng)用這一問題有了更深刻的體會(huì),具體使用情況還需要大家實(shí)踐驗(yàn)證。這里是億速云,小編將為大家推送更多相關(guān)知識點(diǎn)的文章,歡迎關(guān)注!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

vue
AI