Python Full stack development day02

Source: Internet
Author: User
Tags comparison table logical operators

1. Formatted output uses string concatenation to form a template: This leads to formatted output: (Personal business Card making) use of formatted output: The% placeholder S is the character, and D represents the number%s%d%r??? The first format: (Must be one-to-one) the second format: (no one by one correspondence) Note: Formatted output, in the formatted output, the simple representation of% need to use percent of 2.while......else ... (The specific scene will be used) when the while loop is not interrupted by break, then go elsecount = 0while count <=5:count + = 1print (' Loop ', count) else:print (' This cycle is over! ') when the while loop is interrupted by break, then do not go Elsecount = 0while True:count + = 1print (' Loop ', count) if Count = = 5:breakelse:print (' This cycle has ended! ') 3. Operator logical operator (new knowledge point) and with or or not is not the first case: the logical operators are before and after the comparison operation (first priority) Priority concept: () > Not > and > or, the same priority is calculated from left to right 4 True 5 flase 6 Flase The second case: the logical operators are numbers before and after (the same priority is computed from left to right) x or Y if x true, return x, else yx and y if x True, return y, Else X (and and or opposite Other people's ideas:and=  with    0 get 0    back to the right of or =  or     or 1 to 1   Returns the conversion of the Left ( and > or ) number to a Boolean (new knowledge point) int--------->bool not 0 true 0 falsebool---------->int True 1,flase 0 print (1&GT;2 and 3 or 4)----------------the >4 logical operator operation, look first and or not, The process of summarizing the rules of operations from left to right based on priority comparison is as follows: Print (1 > 2 and 3 or 4) #4print (3 and1 > 2 or 4) #4print (4 and 3 or 1 > 2) #34. Encode the first spy war film: Drop drop level 01010101 computer file storage, and the transmission of the file 0101010 the primary password in the computer: ASCII (English, numeric and special characters only) ASCII code is: binary with the character of the comparison table is the leftmost 0 reason is to reserve a bit, in case of eight bits equal to a byte 8bit=1byte a byte to represent a character (character: the smallest unit that makes up the content for example: China-----> ' In ' is a character, ' Country ' is a character a------->65a------->97: Unicode Initial creation is 16-bit two bytes representing one character after the upgrade of 32 bits, four bytes representing one character The disadvantage is that the resource waste is re-upgraded to Unicode----------->utf-8,utf-16 (at least 16 bits for one character) UTF-8: a minimum of eight digits to denote a character letter denoted by a byte (8 bits), The European writings with two bytes go to represent (16 bits), in which the Asiatic writings with three bytes go to represent (24-bit) GBK: National standard letters with one byte to express (8 bits), Chinese with two bytes to represent (16 bit) unit conversion: 1BYTE=8BIT1KB=1024B1MB=1024KB1GB =1024mb1tb=1024gb day3 Dictation code: The conversion relationship between BIT,BYTES,KB,MB,GB,TB. UNICODE,UTF-8,GBK, each encoded in English, Chinese, respectively, in a few bytes.

Python Full stack development day02

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.