"Python" Lalal

Source: Internet
Author: User

#!/usr/bin/env python#-*-coding:utf-8-*-print ABS (123) #abs (number), take the absolute print all ([True,true]) #all (iterable), The loop iterates over the parameters, and if each element is true, then the return value of all is true print all ([false,true]) print any ([round-robin, ']) #any (iterable), the loop can iterate over the parameters, as long as one element is true, Then the return value of any is true print bin (4) #bin (number), converted to binary print hex (4) #hex (number), converted to hexadecimal print Oct (4) #oct (number), converted to octal print BOOL () #bool (self,x), judged true or FALSE, converts an object to a Boolean value: False for Boolean: 0 None ' (empty string) [] (Empty list) (empty tuple) {} (empty dictionary) print callable (111) #callable (object), verifies that an object can be executed by the print Divmod (10,3) #divmod (x, y), x divided by 3 returns Ganso (3,1) print range (1,100) print type (xrange (100))
#!/usr/bin/env python#-*-coding:utf-8-*-#lambda表达式: shorthand for simple functions F2 = lambda x,y,z:x*y*z #f2 = lambda form parameter: function expression, where F2 is a function , you need to call the pass parameter to use print F2
#!/usr/bin/env python#-*-coding:utf-8-*-#isinstance (): Judging object Type temp = ' 123 ' Print isinstance (TEMP,STR) #temp: Objects instantiated through the Str class


"Python" Lalal

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.