Package: pcio
PCIOInput from stdin by format. Values can distrubuted on different lines.importpcio# Input two integer numbers as tuplea,b=pcio.input('ii')# Input a list of integer numbersarr=pcio.input(100,'i')# Input a list of pair float numbersarr=pcio.input(100,'ff')# Input one symbolpcio.input(1)# Input one line by defaults=pcio.input()Function raises EOFError on end of file and ValueError if value is not a number.Input FormatDescriptioniInteger number, skip spaces before numberfFloat number, skip spaces before numberwWord, skip spaces before wordcOne character as stringlOne line as a stringLOne line with new line as a stringaAll input as one stringAlso specialized variantsimportpcioa=pcio.input_int()b=pcio.input_float()c=pcio.input_char()d=pcio.input_word()e=pcio.input_line()Print according to the format specified by the first argument.importpcio# Print by formatpcio.print("Hello,{}!\n","world")# Print a list separated by space and new linearr=[1,2,3,10,12.2,'a']pcio.println(arr)# 1 2 3 10 12.2 apcio.println('{:02i}',arr)# 01 02 03 10 12 apcio.println('{!r}',arr)# [1,2,3,10,12.2,'a']If the first argument is not a string then the format'{} {} {}'is used where the number of parentheses is equal to the number of arguments.Format contain "replacement fields" surrounded by curly braces{}.
Anything that is not contained in braces is considered literal text, which is copied unchanged to the output.
If you need to include a brace character in the literal text, it can be escaped by doubling:{{and}}.replacement_field ::=  "{" [arg_index] [format_spec] "}"
format_spec ::=  "!" "r" | ":" [align][sign]["0"][width]["." precision][type]
align  ::=  "<" | ">" | "^"
sign            ::=  "+" | "-"
width           ::=  digit+
precision       ::=  digit+
type            ::=  "i" | "d" | "o" | "x" | "X" | "e" | "E" | "f" | "F" | "g" | "G" | "s""!r"calls repr() to print.The meaning of the variousalignmentoptions is as follows:OptionMeaning'<'Forces the field to be left-aligned within the available space (this is the default for most objects).'>'Forces the field to be right-aligned within the available space (this is the default for numbers).'^'Forces the field to be centered within the available space.Thesignoption is only valid for number types, and can be one of the following:OptionMeaning'+'indicates that a sign should be used for both positive as well as negative numbers.'-'indicates that a sign should be used only for negative numbers (this is the default behavior).widthis a decimal integer defining the minimum total field width, including any prefixes, separators, and other formatting characters. If not specified, then the field width will be determined by the content.
Preceding the width field by a zero ('0') character enables zero-padding for numeric types.Theprecisionis a decimal integer indicating how many digits should be displayed after the
decimal point for presentation types 'f' and 'F', or before and after the decimal point
for presentation types 'g' or 'G'.
For string presentation types the field indicates the maximum field size - in other words, how many
characters will be used from the field content. The precision is ignored for integer presentation types.The availabletypesare:TypeMeaning's'String format. Numbers is converted to the string ('g' or 'd') and precision is ignored.'d', 'i'Decimal Integer. Outputs the number in base 10. String the 's' format is used instead.'o'Octal format. Outputs the number in base 8. For float numbers and string the 'g' and 's' format is used instead.'x', 'X'Hex format. Outputs the number in base 16.'f', 'F'Fixed-point notation. For strings the 's' format is used and precision is ignored.'e', 'E'Scientific notation.'g', 'G'General format.Select input/output encoding ('utf-8','cp1251'or'cp866').# Select encodingpcio.encoding('cp1251')