In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the functions of Python scripting language, has 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 with you to understand.
Python is an interpretive language and belongs to the project of OpenSource. However, you can use it for commercial purposes.
And it can be sold on a commercial product CD-ROM. Of course, people can also get their installer or source code for free from www.Python.org or OpenSource's website. Python was originally compiled on Apple computers, but now it can run on the world's leading operating platforms. He doesn't only have the Windows version.
At the same time, it can be used on many platforms, such as Linux,Unix, and it is installed as a necessary language for development in RedHat9. The code types of Python can be divided into three types, namely byte code and binary code optimization code.
Their suffixes are .py .pyc .pyo. These codes can be run directly. There is no need to do any compilation or connection. In the use of these types of code, Python will choose different types according to different situations. As follows:
[thread2.py] import thread import time input = None lock = thread.allocate_lock () def threadProc (): while True: print 'sub thread id:' Thread.get_ident () print 'sub thread% d wait lock...'% thread.get_ident () lock.acquire () print' sub thread% d get lock...'% thread.get_ident () print 'sub thread% d receive input:% s'% (thread.get_ident () Input) print 'sub thread% d release lock...'% thread.get_ident () lock.release () time.sleep (1) thread.start_new_thread (threadProc, ()) print' main thread id:' Thread.get_ident () while True: print 'main thread% d wait lock...'% thread.get_ident () lock.acquire () print' main thread% d get lock...'% thread.get_ident () input = raw_input () print 'main thread% d release lock...'% thread.get_ident () lock.release () time.sleep (1)
At run time, the Python scripting language detects whether there are MyPython.pyc files in the current directory of main.py, and if not, imports MyPython.py and generates MyPython.pyc in preparation for the next faster import. In this way, you can reduce a lot of initialization time. Moreover, all this does not require user intervention, the Python scripting language will do it automatically. He doesn't admit that his grammar is relatively simple among many other languages, and he rules out a lot of tedious thinking. As follows:
#! / usr/bin/python axiom 2003 print an a='Hello python' print an a = [2 Hello python 0 Hello python 3] print a [0] above code can be run normally, the result is as follows:
If it is C++, you need to declare at least 3 sets of variables. For Python scripting languages, a variable is fine. Not only that, Python's management of code blocks also has its own unique features.
Thank you for reading this article carefully. I hope the article "what are the functions of Python scripting language" shared by the editor will be helpful to you. At the same time, I also hope that 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.
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.