Tohirjon Odilov | Blog
103 subscribers
133 photos
24 videos
36 files
158 links
Manfaatli bo'lgan bo'lsa hursandman.

https://t.me/t_odilov
Download Telegram
Bir xil kodlarni funksiya qilib qo'yish
#pycharm
Arifmetik amallar
#python
image_2023-08-31_08-45-48.png
137.8 KB
Print color text using ANSI code in Python
#color
#python_color
python-tabulate

On linux:
isntall tabulate => pip install tabulate
current user => pip install tabulate --user

On Windows:
set TABULATE_INSTALL=lib-only
pip install tabulate

Library usages:
>>> from tabulate import tabulate

>>> table = [["Sun",696000,1989100000],["Earth",6371,5973.6],
... ["Moon",1737,73.5],["Mars",3390,641.85]]
>>> print(tabulate(table))
----— -----—— -------------
Sun 696000 1.9891e+09
Earth 6371 5973.6
Moon 1737 73.5
Mars 3390 641.85
----—- -----—- -------------

Quyidagi jadval ma'lumotlar turlari qo'llab-quvvatlanadi:

* ro'yxatlar ro'yxati yoki iterable boshqa iterable
* ro'yxat yoki diktlarning boshqa takrorlanishi (ustunlar sifatida kalitlar)
* takrorlanadiganlar dikti (ustunlar sifatida kalitlar)
* ma'lumotlar sinflari ro'yxati (faqat Python 3.7+, ustunlar sifatida maydon nomlari)
* ikki o'lchovli NumPy massivi
* NumPy yozuv massivlari (ustunlar sifatida nomlar)
* pandas.DataFrame

Headers

The second optional argument named headers defines a list of column headers to be used:

>>> print(tabulate(table, headers=["Planet","R (km)", "mass (x 10^29 kg)"]))
Planet R (km) mass (x 10^29 kg)
-------- -------- -------------------
Sun 696000 1.9891e+09
Earth 6371 5973.6
Moon 1737 73.5
Mars 3390 641.85

If headers="firstrow", then the first row of data is used:

>>> print(tabulate([["Name","Age"],["Alice",24],["Bob",19]],
... headers="firstrow"))
Name Age
------ -----
Alice 24
Bob 19

If headers="keys", then the keys of a dictionary/dataframe, or column indices are used. It also works for NumPy record arrays and lists of dictionaries or named tuples:

>>> print(tabulate({"Name": ["Alice", "Bob"],
... "Age": [24, 19]}, headers="keys"))
Age Name
----- ------
24 Alice
19 Bob


#module
image_2023-09-17_13-18-16.png
151.1 KB
#json
o'qib qaytadan yozish
Agar QtDesigner boʻlmasa oʻrnatish:
sudo apt-get install qttools5-dev-tools

Uni terminaldan ochish uchun:
designer

Bularning hammasi terminal uchun !!!
Forwarded from Naxalov | AI Blog 🔥
O‘z faoliyatini garajda boshlagan startaplar.

1. Hewlett-Packard (1939)
2. Apple (1976)
3. Amazon (1994)
4. Google (1998)

@naxalov
Forwarded from Naxalov | AI Blog 🔥
Ilk start-up deganda birinchi bo‘lib xayolimga HP( Hewlett-Packard ) keldi lekin hech ichdan rasmini ko‘rmagan ekanman.

Hewlett-Packard (HP) 1939 yilda ikki do‘st Bill Hewlett va Dave Packard tomonidan Kaliforniyaning Palo Alto shahridagi garajda asos solingan.

@naxalov
import sys
from PyQt5.QtWidgets import QApplication, QWidget
from PyQt5 import uic

class AppDemo(QWidget):
def __init__(self):
super().__init__()
uic.loadUi('app.ui', self)

if __name__ == '__main__':
app = QApplication(sys.argv)

demo = AppDemo()
demo.show()

try:
sys.exit(app.exec_())
except SystemExit:
print('Closing Window...')
#pyqt