程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Getting started with Python

編輯:Python

Python note

1. Variable

# Variable messge As a variable , Each variable stores a value 
# Variable name Numbers 、 Letter 、 Underline , Array cannot start , Cannot contain spaces , Keywords and method names cannot be used .
# See the name and know the meaning , Hump named 
# Case sensitive 
message ="Hello Python World"
print(message)

2. character string

# A string is a series of characters , It can be double quotation marks or single quotation marks 
print("Hello world")
print('Hello world')
name = "zhangXuHui"
print(name.title()) # title case , The rest are lowercase 
print(name.upper()) # All capitals 
print(name.lower()) # All lowercase 
print("wellcome to beijing "+name) # + String mosaics 
print("good\tbest\nveryGood") # \t tabs \n A newline 
countyr =" XIAN "
print(countyr.strip()) # Remove the spaces before and after the string , The middle space cannot be removed 
info = "Albert Einstein once said, “A person who never made a mistake never tried anything new.”"
print(info)
print(r"d:\three\two\one") #r Original string , Escaped characters will not be escaped after use 
# The end of the backslash indicates that the string does not end 
# Three pairs of single or double quotation marks indicate a long string , Line breaks without escape characters / Space 
# + String splicing 
# * String copy 

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved