cool hit counter Dark Horse Programmer: Getting Started with Python 3 (1), Just Read This_Intefrankly

Dark Horse Programmer: Getting Started with Python 3 (1), Just Read This

Introduction to pythonPython is a high-level combination of interpreted, compiled, interactive, and object-oriented scripting language. Python was invented by GuidovanRossum at the National Institute of Mathematics and Computer Science in the Netherlands in late 1989, and the first publicly available version was released in 1991.

FeaturesEasy to learn: Python has relatively few keywords, a simple structure, and a well-defined syntax that makes it easier to learn. Easy to read: Python code is more clearly defined. Easy to maintain: Python's success lies in the fact that its source code is quite easy to maintain. An extensive standard library: one of Python's greatest strengths is a rich library that is cross-platform and compatible well on UNIX, Windows and macOS.

The most unique feature of line and indentation Python is the use of indentation to represent blocks of code without the use of curly braces {}. The number of indented spaces is variable, but statements in the same block of code must contain the same number of indented spaces. Inconsistent indentation can lead to runtime errors. Multi-line statements Python usually writes one statement in one line, but if the statement is long, we can use backslashes to implement multi-line statements.

comparison operator

assignment operator

bitwise operator

logical operator

Member operators

identity operator

operator priority

Operators with the same priority will be sequenced in a left-to-right fashion. The order of operations can be changed with parentheses().

Random number functions Note: The following functions are used with the random package imported first.

Trigonometric functions Note: The use of the following functions requires importing the math package first.

mathematical constant

Dark Horse Programmer: Getting Started with Python 3 (1), Just Read This

String Operators

String formatting inPython in, String formatting is notsprintf function, Instead, they use% symbolic。 for example:print(" My name is...%s, next year%d year (of crop harvests)!"%(' Simon',10))// exports: My name is Ming., next year10 year (of crop harvests)! formatting symbol:

Auxiliary instructions :

Starting with Python 2.6, there is a new function str.format() for formatting strings, which enhances string formatting.

Bytes (bytes)

In 3.x, strings and binary data are completely distinguished. Text is always Unicode, represented by the str type, and binary data is represented by the bytes type. Python3 doesn't mix str and bytes in an arbitrary implicit way, you can't splice strings and byte streams, you can't search for strings in a byte stream (and vice versa), and you can't pass strings into functions whose arguments are byte streams (and vice versa).

First, the try clause (the statement between the keyword try and the keyword except) is executed if no exception occurs, the except clause is ignored, and the execution of the try clause ends. If an exception occurs during the execution of the try clause, then the remainder of the try clause is ignored. If the type of the exception matches the name after except, then the corresponding except clause will be executed. Finally, execute the code after the try statement.

File object method fileObject.close() The close() method is used to close an open file. The closed file cannot be read or written again, otherwise it will trigger a Valueerror error. The close() method is allowed to be called multiple times. When the file object, is referenced to operate on another file, Python automatically closes the previous file object. It is a good habit to use the close() method to close the file.

1、Some small C4D exercises
2、Animal Crossing Were not the same and were the same
3、Late Night Miscellany Club I
4、Happy Blocks mobile mining every Happy Block has value
5、Official Trailer Released for Netflixs New SciFi Film TAU

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送