Mandatory:
- https://www.youtube.com/watch?v=YV6qm6erphk
- https://www.youtube.com/watch?v=WN4A6iJOUns
- General introduction to modules
- General introduction to file handling / IO
open()
and parametersr, w, a
close()
write()
read()
,readline()
andreadlines()
module
andsubmodule
import
from
help()
- OS module
- Requests module
- First of all, you should copy all files to your working directory from
01-io
and02-pip
folders
- You can see all the tasks there, with a prepared skeleton to work in
- The reason for that is so you can check your work with tests
- There's a
test.py
in every corresponding folder, try and run it - The only thing matters from here is to get these to pass :)
my_file = open("file_name.txt", "r")
4 different ways of reading:
my_file.read()
my_file.readline()
my_file.readlines()
for line in my_file:
print(line.rstrip())
>>> help(str.rstrip)
split()
" ".join()
my_list[start:end:step]
ord('a')
chr(97)
CSV - The Python Standard Library Docs
At first try to use the CSV Library Module to read the contents of otos.csv
.
PIP is a tool for installing packages from the Python Package Index.
pip3 --version
/// pip --version
(If you don't have pip, install it! Search for the commands for your operating system)
Install an external package
PrettyTable PrettyTable short tutorial
pip3 install prettytable
/// pip install prettytable
Print the five most frequent numbers and how many times they have occurred!