搜尋此網誌

顯示具有 Python 標籤的文章。 顯示所有文章
顯示具有 Python 標籤的文章。 顯示所有文章

2020年5月18日 星期一

How to read the screen resolution by python3.7


If we want to know the windows' screen resolution, we can use the win32api and win32con to get the value from windows.
The example as below.

import win32api, win32con

y = win32api.GetSystemMetrics(win32con.SM_CYSCREEN)
x = win32api.GetSystemMetrics(win32con.SM_CXSCREEN)

print(x, ",", y)
The execution result:

2560 , 1080

Process finished with exit code 0









2020年5月15日 星期五

About the difference between os.exit () and sys.exit () in python

The sys.exit() the return code can be capture by caller, but os.exit() just end the process.

In the python documentation has below explain.
  • os.exit()

  • sys.exit()

2020年5月14日 星期四

How to create a requirement file of python project

For each project, we need a file that records the project's software package in the required format.
So we can use the freeze command to output the software package version.

The pip has command freeze that will list all software package version.
pip help message

We can use the freeze to export the requirement.txt.

The file will including the software package version.


How to install the software package in the new environment?


2018年10月8日 星期一

Python 筆記: 二維列表使用

筆記:

H_1 = [1, 11, 111]
H_2 = [2, 22, 222]
H_3 = [3, 33, 333]
H_4 = [4, 44, 444]
H_5 = [5, 55, 555]
H_6 = [6, 66, 666]

a = [H_1, H_2, H_3, H_4, H_5, H_6]

print(a[5][2])

output:
666