$ python -c "import calendar,datetime;today=datetime.datetime.today();calend=calendar.TextCalendar();calend.prmonth(today.year, today.month)"
May 2021
Mo Tu We Th Fr Sa Su
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
$ date "+%Y %m" | xargs python -m calendar
May 2021
Mo Tu We Th Fr Sa Su
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31
import calendar,datetime
today=datetime.datetime.today()
calend = calendar.TextCalendar()
calend.prmonth(today.year, today.month)
# -*- encoding: utf-8 -*-
from __future__ import print_function
root@ubuntuServer:~# python3 --version
Python 3.4.3
root@ubuntuServer:~# cat /etc/issue
Ubuntu 14.04.6 LTS \n \l
root@ubuntuServer:~# python3 ./hello.py
Привет мир!
root@ubuntuServer:~# cat hello.py
print("Привет мир!")
root@ubuntuServer:~# file hello.py
hello.py: UTF-8 Unicode text
import ast
# первые 5 значений - корректные варианты написания чисел в python
input_data = ['5678', '-5', '665.89', '1_000_000', '-0.775', '0.78587.99', 'dfsdf']
def get_type(data):
try:
res = type(ast.literal_eval(data)).__name__
except:
res = 'error'
return res
print([get_type(x) for x in input_data])
# ['int', 'int', 'float', 'int', 'float', 'error', 'error']
>>> number = 377826
>>> f'{number:,}'
'377,826'
>>> number = 377826875875875
>>> f'{number:,}'
'377,826,875,875,875'
>>> f'{number:,}'.replace(',', '.')
'377.826.875.875.875'