Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the Python workers who make python work more efficiently?

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces the python work to make more efficient Python small workers have what, have a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to know about it.

As a more and more popular programming language, ython is not only because of its simple language, but also because there are many ready-made packages that can be called directly.

There are plenty of gadgets in python to make your python work more efficient.

1. Fast sharing

HTTP server

SimpleHTTPServer is python's built-in web server, which is shared using port 8000 and HTTP protocol.

To be able to quickly build a HTTP service and shared service on any platform (Window,Linux,MacOS), you only need to build a good python environment.

Python2 version:

Python-m SimpleHTTPServer

Python3 version:

Python-m http.server

FTP server

Ftp sharing requires the support of third-party components, installation commands:

Pip install pyftpdlib python-m pyftpdlib-p port number

Access method: ftp://IP: port.

two。 Decompress

This paper introduces the use of python to extract five compressed files: .gz .tar .zip .rar

Zip

Tar

Gz

Gz typically compresses only one file, all of which often work with other packaging tools. For example, you can package it to X.tar with tar, and then compress it to X.tar.gz.

To extract gz is to actually read out a single file. The Python method is as follows:

Rar

Since rar is usually used under window, an additional Python package rarfile is required.

Installation:

Python setup.py install

Unzip:

Common operations of 3.pip

Pip is a famous package management tool of Python, which is essential in Python development.

Installation

Online installation

Pip install or pip install-r requirements.txt

Local installation:

Pip install / or pip install-use-wheel-no-index-find-links=wheelhouse/

Look up the package

Pip search

Delete package

Pip uninstall or pip uninstall-r requirements.txt

View package information

Pip show

Check whether package dependencies are complete

Pip check

View a list of installed packages

Pip list

Export all installed packages

Pip freeze requirements.txt

4. Conversion between string and Json

Json to str

Json to str

Using the json.dumps method, you can convert a json object to a string.

5. Python reads excel

Steps

Install python official Excel library-> xlrd

Get the Excel file location and read

Read sheet

Read the specified rows and cols content

6. Python screenshot

Python to achieve screenshot function, windows environment, need to use PIL library.

Installation:

Pip install Pillow

Example:

7. Ipython

Finally, it shows a powerful python tool-IPython.

IPython supports automatic completion of variables, automatic indentation, support for bash shell commands, built-in many practical functions and functions

It's a for Humans Python interactive shell, and you don't want to use your own Python shell after using it.

Thank you for reading this article carefully. I hope the article "what are the Python workers who make python work more efficient" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report