Python Programming Fundamentals study notes summary 000

Programming Fundamentals Summary 000

1, computer architecture

2, the programming language classification

3, the origin of the character encoding

 

Computer Architecture

  Computer Organization five components: a controller, the arithmetic unit, memory, input, output

  The controller (Controler): control information interpreted predetermined program controlled according to its request, scheduler, data, addresses, each part of the work coordinating computer peripherals and memory access and so on.

  Operator (Datapath): the data arithmetic and logic operations, data processing;

  Memory: store programs, data and all kinds of signals, commands, and other information, and provide this information when needed.

  Enter: the program, the raw data, text, characters, control commands cargo data collected in the field and other information into the computer. For example: keyboard mouse camera like a microphone

  Output: output the result out information in the intermediate or final results of the computer, the various data symbols and text in the machine or various control signals. For example: a printer, a display, a speaker, a plotter.

 

Computer software category:

  System software, application software

  System software: operating system Linux Windows MAC

  Applications: various APP, micro-channel, QQ, deft like.

 

Programming languages ​​Category:

  Compiled languages: C .NET language such as C ++ language

  Interpreted languages: Java, Python

Compiled language: Source ------- ---- compiled "intermediate files (.o, and .obj) --------- --------- connection and assembler - "machine code (binary) ---" exe executable file

Compiled language must be compiled in the execution.

An interpreted language: Source --- compiling - "bytecode interpreter --- -----" executable machine code corresponding platform

 

Python basis

Direct assignment:

   a = 1 

  b  = 2

  c  = 3

Do not declare the type of view variable type print ( "type (a)")

Variable naming rules: 1, can not start with a number;

        2, do not use the keyword variable;

        3, constitute the variable name: alphanumeric characters and underscores 

        4, variable names do see the name to know as much as possible Italian

 

Notes Python way:

  1, single-line comments to "#" start

  2, three multi-line comment with the three single or double quotes 

  a = 1 # variable assignment

  b = 2  ''' asdfsdafasdfasfasfass  

     asdfasfasdfasf

     '''

  c  =  3   """ asdfadsfasdfasfas

       """

String manipulation:

  Stitching: +

  copy:*

  Takes a string of characters: []

   Slicing all characters starting at start before taken to end: [step start:: end ]

      • [:] extracted from the beginning to the end of the entire string
      • [start:] extracted from the start to the end
      • [: end] extract from beginning to End - 1
      • [start: End] extracted from start to End - 1
      • [ start: end: step] extracted from the start to the end - 1, each step extracting a character

  Use len () obtained length

    >>> len(letters)
    26
    >>> empty = ""

    >>> len(empty)
    0

  Use split () split

  >>> todos = 'When HHH , apple banana orange, water milk juice'

  >>> todos.split(',')
  ['When HHH ', ' apple banana orange', ' water milk juice']

  Use join () merge

  >>> Lista = ['one','two','three','four']
  >>> ListaString = ','.join(Lista)
  >>> ListaString
  'one,two,three,four'
  >>>

 

Capitalization and alignment

  The ending of the string are deleted out:
  >>> Setup .strip ( '.')
  'A Duck goes INTO A bar'

  Let string first letter capitalized :
  >>> Setup .capitalize ()
  'A Duck goes INTO A bar ...'
  all words beginning with the letter capitalized :
  >>> Setup .title ()
  'A Duck Goes into A Bar ... '
  so that all the letters are capitalized :
  >>> Setup .upper ()
  ' A DUCK GOES iNTO A BAR ... '
  will convert all letters to lowercase :
  >>> Setup .lower ()
  ' a duck goes into a bar ... '
  to all the letters case conversion :
  >>> Setup .swapcase ()
  ' the INTO a a DUCK the bAR ... the gOES '

  Use replace () Replace

  The last parameter is omitted if only the first alternative default
  Python basic elements: a position number, the first occurrence of the string and the variables:
  >>> Setup .replace ( 'Duck', 'marmoset')
  'A marmoset goes INTO A bar .. '
  modify 100 up :
  >>> Setup .replace (' A ',' A Famous', 100 )
  'A Famous Duck goes Famous INTO A bar ...'

  

  

 

Guess you like

Origin www.cnblogs.com/jingle007/p/11101641.html