In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-06 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Today, I will talk to you about how to use simple python http services to share files. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Today, I bring you a trick of "cool techs"-using Python to send computer files directly to your mobile phone (or ipad). I happened to hear my brother talk about it a long time ago. I feel amazing. I can share it with you and feel the powerful magic of Python once again.
0. Preparatory work
Equipment required: a computer with Python installed (both mac and windows), a mobile device, such as a mobile phone or ipad
1. Enable the HTTP service
Open the terminal and go to the directory where the file to be sent is located. The file to be sent here is test.csv, located under the'/ Users/chc/Desktop/testhttp' path, as shown in the figure.
The file to be sent and its path
Run the command 'python-m SimpleHTTPServer 8000' to start the HTTP service. Where 8000 is the port number, which can be changed to something else. When enabled, the status is as follows:
two。 Check the computer's IP address
Open a new terminal, run the command 'ifconfig' (ipconfig under win), and check the IP address of the computer. Output information is more, need to "find". This is 10.48.169.103. Write down this address, which will be used later.
3. Connect HTTP service with mobile phone
Open the phone or ipad, enter the address in the browser: http:// just recorded the ip address: 8000 (port number to enable the service), you can see the test.csv file in the browser. Click on the file to download it. This makes it possible to transfer files from the computer to the mobile phone. The screenshot is as follows:
Click on the file to download directly.
We use Python to open the HTTP service, and access the service through the mobile phone to achieve file transfer. The principle is not complicated, and the process may not be so "simple" (you may think it is much more convenient to send files to your phone via Wechat), but it reflects the instrumental nature of Python. Let us realize the power of Python.
Similarly, Python can also turn on ftp services and implement file transfer. To install the pyftpdlib package before use, execute the command 'python-m pyftpdlib-p 8888' to start the service. 8888 is also the port number. Use the ftp://ip address: Port number when accessing.
After reading the above, do you have any further understanding of how to use simple python http services to share files? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.