1. Formatted output %
text %s
number %d
# name = input('Please enter your name:') # age = int('input('Please enter your age:')) # job = input('Please enter your job name:') # hobbie = input('Please enter your hobbies: ') # msg = ''' # ------------ info of %s ----------- # Name : %s # Age : %d # job : % s # Hobbie: %s # ------------- end ----------------- # ''' % (name,name,age, job,hobbie) # print(msg)
Second, the operator
()> not > and > or
Same class from left to right
Divided into two cases (before and after are comparisons, before and after are numbers)
三、while else
The end of the while loop is to execute the else, if the break is encountered, it will jump out directly, and the else will not be executed
# count = 1 # while count <= 5: # print(count) # count = count + 1 # else: #End of loop and go else # print('The loop is over') # print('I have a bottom line') # count = 1 # while count <= 5: # print(count) # count = count + 1 # if count == 4: # break #When count meets the if condition, go directly to the following break to jump out, no longer go else # else : # print('1')
Fourth, coding first knowledge
1, ASCII: letters, numbers, special characters
8 bits make up a byte to make up a character.
Character: the smallest unit that makes up the content
2. Universal code unicode
16 bits, all represented by two bytes, such as Chinese characters, etc. cannot be completely represented
upgrade:
32 bits, all represented by 4 bytes, waste of resources
upgrade:
utf-8: a minimum of 8 bits to represent a character
a : one byte (8 bits)
European text: two bytes (16 bits)
Asian text: three bytes (24 bits)
utf-16: a minimum of 16 bits to represent a character
Three, gbk (national standard)
a : one byte (8 bits)
Chinese: two bytes (16 bits)
Four, 8 bits 8bit= 1byte
1024bytes =1kb
1024kb = 1MB
1024MB = 1GB
1024GB = 1TB