In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to use the new grammar of Python3". Many people will encounter such a dilemma in the operation of actual cases, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
The development of Python
Python is one of the most popular and developed programming languages. Based on the TIOBE score, a software quality company claims that Python is an aggressive programming language. By 2020, Python replaced Java in second place. However, the number one ranking is still c. This is an impressive achievement made by Python over the past 20 years.
Why is Python unstoppable? First of all, Python works well in machine learning and deep learning. We can start with Google and develop simple machine learning or deep learning for people through Google collaboration Lab (Colab). People can run their machine learning or deep learning code on machines provided by Google Colab. Google Labs hosts the Jupyter project to build a Jupyter notebook environment in Google Labs.
Secondly, Python is growing in the field of Internet of things (IoT). According to the 2018 survey of Internet of things developers conducted by the Eclipse Foundation, Python ranks among the top four programming languages of the Internet of things. If we look back at the TIOBE index, I believe Python will beat other languages. In 2019, StackOverFlow emphasized this, meaning that Python was among the top four most popular programming, scripting, and markup languages. This is a huge step forward for Python because Python overtook PHP in 2017 and c # was defeated in 2018. Python is the fastest growing programming language.
Third, Python is the best programming language to start the journey of data science. Python is open source, so many people are developing it for a variety of topics, from scientists to corporate data analysts. They build various Python libraries, such as Vaex and PyMC3 that can read 1 million rows of data, to explore high-dimensional parameters in the Bayesian reasoning paradigm.
The Prospect of Python
So, will Python die in 2021? According to Wikipedia, Python was first released by Guido van Rossum in 1991. Now, Python is 29 years old. Klingenberg and his colleagues discovered in 1995 that the typical lifespan of a captive python (Python) is between 20 and 30 years. If Python is imitating Python, then Python will die in 2021. However, I believe that Python will not die out in 2021, because it turns out to be unstoppable. Maybe, in 2021, we will encounter a new version of Python, Python4.
On October 4th, 2020, Python.org released the final version of Python 3.9.0. Some new grammars are:
01.
A federated operator added to the dict. With this PEP, you can merge and update dictionaries. Here is an example of merging and updating dictionaries.
X = {"dict1": "x1", "dict2": "x2"} y = {"dict2": "y1", "dict3": "y2"} # merge dictx | y
As a result,
{'dict1':' x1regions, 'dict2':' y1bands, 'dict3':' y2'}
You can use (| =) to update the dictionary. Here is an example
X = {"dict1": "x1", "dict2": "x2"} y = {"dict2": "y1", "dict3": "y2"} # update dict xx | = y
If you print x, the result is
{'dict1':' x1regions, 'dict2':' y1bands, 'dict3':' y2'}
02.
Types in the standard collection prompt generics. With this PEP, you can use built-in collection types (list and dict) as generic types instead of corresponding to uppercase types (such as list or dict) in typing.
03.
The syntax restriction of decorator has been relaxed. With this PEP, you can use any valid expression as a decorator.
04.
You can use the system time zone data provided by zoneinfo. To use it, you can read the following code.
From zoneinfo import ZoneInfofrom datetime import datetime, timedelta
Dt = datetime (2020, 10, 31, 12, tzinfo=ZoneInfo ("America/Los_Angeles"))
If you print the variable dt, you will get this result
2020-10-31 12:00:00-07:00
The result will tell you the year, month, and date. After that, you will get the GMT-7 time of the location in Los Angeles. It is good to use a specified date and time, for example, astronomers. Astronomers need this parameter to track the rover's celestial bodies, such as planets, asteroids and comets in the solar system.
05.
A string method for deleting prefixes and suffixes. You can use this PEP to delete prefixes and suffixes. Here is an example
String = 'Hello World'# remove prefixstring.removeprefix (' Hello')
As a result,
'World'
Here is an example of deleting a suffix
String = 'Hello World'# remove prefixstring.removesuffix (' World')
You'll get this result.
So much for the introduction of 'Hello', "how to use the New Python3 Grammar". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.