位元組跳動測開實習面試題

2021-10-02 22:33:00 字數 820 閱讀 3151

大小寫

標點符號

縮寫

import string

defget_dict_word_times

(file):

""" :param file: 需要查詢的檔案

:return: 字典

"""# 將文章中的單詞以空格切分(此時帶標點符號)

list_word_with_punctuation =

file

.read(

).split(

)# 去掉標點,並不區分大小寫

list_word =

[word.strip(string.punctuation)

.lower(

)for word in list_word_with_punctuation]

# 去重

set_word =

set(list_word)

return

defmain()

:with

open

(r"demo.txt"

,"r")as

file

: dict_word_times = get_dict_word_times(

file

)return dict_word_times

print

(main())

"""strip()用來一處字串頭尾指定的字元或字元數列

只能刪除開頭的或者是結尾的字元,不能刪除中間的

string.punctuation找出字串中的標點

"""

位元組跳動面試題

位元組跳動面試題 http協議 http協議是乙個應用層的協議,由請求和響應構成,使用統一資源識別符號來傳遞資料和建立連線 一次http請求的基本流程一般是,在建立tcp連線後,由客戶端向服務端發起一次請求 request 而伺服器在接收到以後返回給客戶端乙個響應 response 所以我們看到的h...

位元組跳動面試題

假如有兩台伺服器 server1和server2 這兩台伺服器上分別部署了相同的前端靜態檔案,index.html index.js 如果server1中的靜態資源被更新了,那麼此時會出現什麼問題?如何解決?通過控制 伺服器,讓客戶無感平滑公升級 root 當前頁面共有 files.length 個...

位元組跳動面試題

1 請分析以下 執行結果 async function a return result var p a p.abort 2 手寫乙個節流函式 手寫節流函式3 什麼是裝箱和拆箱 裝箱和拆箱操作,能夠在值型別和引用型別中架起一做橋梁。換言之,可以輕鬆的實現值型別與引用型別的互相轉換。裝箱是將值型別轉換為...