<jupyter_start><jupyter_text>I/O File I/OSimilar to fopen() in *C*, `open() close() read() write() seek()` are supported, not only these function calls, `readline() readlines()` are also supported.File object can be treated as a iterator, may be it is more common.`print()` function can write to file with `file=` option. `open(), close(), readline(), print()` will be most commonly used function for text I/O.`readline()` function returns the 1 line data include `\n`, and returns '' (0 length string) for EOF (End Of File).<jupyter_code>fd = open('README.md', 'r')
print(fd.readline(), end='')   # \n is included in input string

for s in fd:      # file object(descriptor) is iterable, and can be used in for loop
    print(s.strip())    # strip() removes extra space and \n
    # print(s.split())  # convert string to List<jupyter_output><empty_output><jupyter_text>Data conversionint() function convert string or float to integer, str() convert to string, float() convert to float.map(func, iterable-object) apply function to iterable-object and returns iterable object.<jupyter_code>s = '100'
print(int(s)+1)

s = '1 2 3'
for i in map(int, s.split()):
    print(i)
s = '1 2 3 4'
x = list(map(int, s.split()))
print(x)

y = list()
for i in s.split():  # ['1', '2', '3', '4']
    y.append(int(i))
    
print(y)<jupyter_output><empty_output><jupyter_text>Standard In, Standard Out and Standard Errorsys.stdin, sys.stdout and sys.stderr are file descriptors which are already opened for application programs.stardard-in is assinged to keyboard, standard-out and standard-error are assinged to display as a default. These assigned can be overrided when executing the program from shell.```$ program_name <input_file$ program_name >output_file$ program_name output_file$ program_name 2>error_file```<jupyter_code># need to import sys module to use standard I/O file descriptor
import sys
print('input somthing: ')

# jupyter does not handle stdin ?
# sys.stdin is used as a file-descriptor
s = sys.stdin.readline()
print(s.split())   # convert input to List<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12458073790129372, 'fraction_numerical': 0.008624820316243412, 'mean_word_length': 4.931818181818182, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '33909', 'license': 'MIT', 'n_tokens_mistral': 674, 'n_tokens_neox': 651, 'n_words': 256, 'path': 'Python-7 Input and Output.ipynb', 'repo_name': 'ShinjiKatoA16/UCSY-sw-eng', 'size': '2087'}