Skip to main content

Programming contest input/output module

Project description

PCIO

Input from stdin by format. Values can distrubuted on different lines.

import pcio

# Input two integer numbers as tuple
a,b=pcio.input('ii')

# Input a list of integer numbers
arr=pcio.input(100,'i')

# Input a list of pair float numbers
arr=pcio.input(100,'ff')

# Input one symbol
pcio.input(1)

# Input one line by default
s=pcio.input()

Function returns None on end of file and NaN if value is not a number.

Input Format Description
i Integer number, skip spaces before number
f Float number, skip spaces before number
w Word, skip spaces before word
c One character as string
l One line as a string
L One line with new line as a string
a All input as one string

Also specialized variants

import pcio

a=pcio.input_int()
b=pcio.input_float()
c=pcio.input_char()
d=pcio.input_word()
e=pcio.input_line()

Print by format (format not implemented yet)

# Print by format
pcio.print("Hello, {}!\n", "world")

# Print a list separated by space and new line
pcio.println(arr) 

Select input/output encoding (utf-8, cp1251 or cp866). Implemented for input only yet.

# Select encoding 
pcio.encoding('cp1251')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pcio-1.0.0.tar.gz (7.5 kB view hashes)

Uploaded Source

Built Distribution

pcio-1.0.0-cp312-cp312-win_amd64.whl (12.2 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page