一些知識點

2021-10-20 19:35:19 字數 1117 閱讀 2274

字串拼接:

1.『a』.join(b)—-a為元素之間的分隔符,b為待分割的序列:(可用於輸出時的資料處理,元素間有空格,末尾沒有)

2』%s %s %s』 %(str1,str2,str3)

前半部分為字串,後半部分為索引。%用於引入,s是物件

』3.』{}{}{}』.format(str1,str2,str3)與f『{}{}』括號裡為已有變數

關於format函式—如果大括號裡沒有索引,則按預設順序/大括號裡有索引,則format括號為索引。**特別是字典的使用,site與鍵從字串變成變數

>>

>

"{} {}"

.format

("hello"

,"world"

)# 不設定指定位置,按預設順序

'hello world'

>>

>

" ".

format

("hello"

,"world"

)# 設定指定位置

'hello world'

>>

>

" "

.format

("hello"

,"world"

)# 設定指定位置

'world hello world'

print(.

format

(name=

"菜鳥教程"

, url=

"www.runoob.com"))

# 通過字典設定引數

site =

print(.

format

(**site)

)# 通過列表索引設定引數

my_list =

['菜鳥教程'

,'www.runoob.com'

]print(.

format

(my_list)

)# "0" 是必須的

正規表示式

import re

if re.match(r』apa+ta,text)

re.split(r』p|t』,text)

一些知識點

1.vector是在堆上還是棧上?在堆上.2.我們發現指標有一些 似是而非 的特徵 1 指標消亡了,並不表示它所指的記憶體會被自動釋放。比如函式中的指標是區域性變數,如果它指向了堆上,而自己出了函式後消亡了,但它所指向的記憶體還是存在的,導致了記憶體洩漏.2 記憶體被釋放了,並不表示指標會消亡或者成...

一些知識點

1 sln 解決方案檔案 csproj 專案檔案 cs 原始檔 解決方案包含多個專案,每個專案都是乙個程式。config 配置檔案 3 const int a 1 const 定義乙個量為常量,運算中用到當常量使用,不可以再重新賦值。4 型別轉換。1 隱式轉換。從值型別轉換成引用型別。從引用型別轉換...

一些知識點

column name 列名稱 information schema.columns 表示所有列的資訊 在整個mysql裡面 information schema 表示所有資訊,包括庫 表 列 information schema.tables 表示所有表的資訊 table schema 資料庫的名...