from tabulate import tabulate
table = [
["Sun",696000,1989100000],
["Earth",6371,5973.6],
["Moon",1737,73.5],
["Mars",3390,641.85]
]
headers = ['planet', 'R(km)', 'mass']
print(tabulate(table, headers, tablefmt="grid"))
+----------+---------+---------------+
| planet | R(km) | mass |
+==========+=========+===============+
| Sun | 696000 | 1.9891e+09 |
+----------+---------+---------------+
| Earth | 6371 | 5973.6 |
+----------+---------+---------------+
| Moon | 1737 | 73.5 |
+----------+---------+---------------+
| Mars | 3390 | 641.85 |
+----------+---------+---------------+
num = 20
print('-'*num, '|'+'test'.center(num-2)+'|', '-'*num, sep='\n')
--------------------
| test |
--------------------
for i in range(1, 999999999):
if i % 10 == 0:
continue
print("12345678{:<09d}".format(i))
# 12345678100000000
# 12345678200000000
# 12345678300000000
# 12345678400000000
# 12345678500000000
# 12345678600000000
# 12345678700000000
# 12345678800000000
# 12345678900000000
# 12345678110000000
# 12345678120000000
...
collected_data = [
{'pattern': ['#c', 'c#'], 'result': []},
{'pattern': ['java'], 'result': []}
]
...
for name in vacancies_names:
for data in DATA:
if any([x in name.get_text().lower() for x in data['pattern']]):
data['result'].append(text)
continue
from pip._internal.cli.main import main
main(['install', 'xlrd'])
#Collecting xlrd
# Downloading xlrd-2.0.1-py2.py3-none-any.whl (96 kB)
# |████████████████████████████████| 96 kB 541 kB/s
# Installing collected packages: xlrd
# Successfully installed xlrd-2.0.1
# WARNING: You are using pip version 21.1.1; however, version 21.2.4 is available.
# You should consider upgrading via the '/opt/.../rvenv/bin/python -m pip install --upgrade pip' command.
import xlrd
xlrd.__version__
# '2.0.1'
main(['freeze'])
# aioredis==1.3.1
# amqp==5.0.6
# argon2-cffi==20.1.0
# asgiref==3.3.4
# ...
pip freeze > requirements.tmp
occurence_count = Counter(map(lambda x:cv2.contourArea(x), contours))
most_common_area = round(occurence_count.most_common(1)[0][0])