Print formatted output
#-*-coding:utf-8-*-#Print (Format (val, ' M,n '))#val: Value format_modifier: Output placeholder m, accuracy nPrint(Format (12.3456,'6.2f' )) 12.35Print(Format (12.3456,'6.3f' ))12.346Print(Format (12.3456,'6.6f' ))12.345600Print(Format (12.3456,'6.0f' )) 12
Print input statement
The value received by input is converted to a character type, and int () converts the value to integer data, and float () converts the value to floating-point data
#-*-coding:utf-8-*-name= Raw_input ('Please enter your name:')PrintnamePrinttype (name) age= Raw_input ('Please enter your age:') Age=Int (age)Printtype (age) age= age + 1PrintAgeweight= Float (Raw_input ('Please enter your weight:'))PrintWeightPrinttype (weight)"""Run Results"""Please enter your name: Leelee<type'Str'>Please enter your age:13<type'int'>14Please enter your weight:40.2240.22<type'float'>
Variable resolution
Variable change only point to address does not change point to content
# -*-coding:utf-8-*- = print = Print = y print = Print Z, id (z)""" run result """ 13 7349606412 7349607612 7349607613 73496064
Python basic OUTPUT statement/INPUT statement/variable parsing