[5, data type] Zero basic learning python, simple and rude

The basic data types in variables are

  • int, integer;
  • float, float;
  • complex, complex type;
  • bool, Boolean type, the value can be True or False, respectively equal to 1 and 0 of the integer type;
  • str, string type;
  • Object type, an instance of a class;
    • None, NoneType
        # Integer
          intVar = 12
          print(type(intVar))
      
          # float
          floatVar = 12.0
          print(type(floatVar))
      
          # complex type
          complexVar = 12 + 34d
          print(type(complexVar))
      
          # boolean type
          boolVar = True
          print(type(boolVar))
      
          # string type
          strVar = " Life is short, please use Python "
          print(type(strVar))
      
          # object type
          objVar = Canvas()
          print(type(objVar))
      
          # empty type
          noneVar = None
          print(type(noneVar))

       

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325620202&siteId=291194637