初入python,輸出和輸入,筆記002

2021-08-18 04:25:28 字數 744 閱讀 7727

學習python要從興趣開始,邊用邊學,學以致用才能快速學會。

python程式安裝好後,迫不及待的想試試寫個**。根據歷史套路,我也寫個hello world。

print('hello world!')   

我開啟ipython寫入,正常輸出hello world!  

python的輸出很簡單就是print()。那麼要列印一下我的名片怎麼打呢?

print('姓名:******x')

print('職位:***x')

發現python的print()每次都會換行,打乙個print()換一次行。

於是我有啦別的嘗試:

print('姓名:xx','***x')  #  ''引號裡面的都是字串寫什麼打什麼。 「,」逗號可以隔開,相當於空格

print('**',1111111)  #可以打數字,也可以數字和字串一起打,中間用逗號隔開

print('***x'+'***x') # 字串可以用加號鏈結

print(1+2)   #數字可以直接計算結果

但是數字和字串不能一起計算,當然自然界中也是不能這麼幹。

print('*'*3)  #字串用*可以複製,1個變多個

我們打個名片看看:

print('='*30)

print('姓名','鹹蛋超人')

print('年齡',18,'歲')

print('**',12345678901)

print('='*30)

初入typescript筆記

typescript 的基本型別 1.number 數字型別 example let val number 2 2.string 字串 example let val string 2 3.boolean 布林型別 example let val boolean false 4.array 陣列 e...

初入Springboot筆記

實體類 component configurationproperties prefix person 預設從全域性配置檔案中獲取值,全域性檔案中沒有的話從 propertysource指定的路徑獲取 public class person private string lastname priva...

Python 學習筆記 001 輸出和輸入

在此感謝廖雪峰老師出的新手教程 print hello,world hello,world 列印字串 print abc 123 ab 12 abc 123 ab 12 預設以 將多個字串連線並列印出來 print 200 200 列印整數 print 200 100 300 列印運算結果 prin...