DailyPythonTips's profile picture.

Daily Python Tips

@DailyPythonTips

Daily Python Tips reposteó

Python is the #1 programming language in the world: bit.ly/2eNNcO9 - Proud to be part of this wonderful community. #positivepython


zip(zero or more) function allows you to iterate over number of iterables. #Python

DailyPythonTips's tweet image. zip(zero or more) function allows you to iterate over number of iterables. #Python

You can concatenate list of string using String join() method #Python

DailyPythonTips's tweet image. You can concatenate list of string using String join() method #Python

filter (function,iterable) - evaulate given iterable against a condition and creates new iterable with items passing that condition. #Python

DailyPythonTips's tweet image. filter (function,iterable) - evaulate given iterable against a condition and creates new iterable with items passing that condition. #Python

map() creates a new iterable by applying a given function to every element of the source iterable. #Python

DailyPythonTips's tweet image. map() creates a new iterable by applying a given function to every element of the source iterable. #Python

Using timedelta to find the differences between dates in #Python.

DailyPythonTips's tweet image. Using timedelta to find the differences between dates in #Python.

Try using strftime function to convert python date-time object to string. #Python

DailyPythonTips's tweet image. Try using strftime function to convert python date-time object to string. #Python

Generators are iterators where the values are generated at the time of need without creating or saving all items. #Python

DailyPythonTips's tweet image. Generators are iterators where the values are generated at the time of need without creating or saving all items. #Python

You can pass function as an argument, assign a #function to a variable in #Python.

DailyPythonTips's tweet image. You can pass function as an argument, assign a #function to a variable in #Python.

Try using built-in method 'enumerate' for any iterables in #Python.

DailyPythonTips's tweet image. Try using built-in method 'enumerate' for any iterables in #Python.

Python treats mutable default arguments in function definitions differently #Python Here comes both good and bad practice.

DailyPythonTips's tweet image. Python treats mutable default arguments in function definitions differently #Python
Here comes both good and bad practice.
DailyPythonTips's tweet image. Python treats mutable default arguments in function definitions differently #Python
Here comes both good and bad practice.

Try using two leading underscores ( __x ), to define private class variables. #Python

DailyPythonTips's tweet image. Try using two leading underscores ( __x ), to define private class variables. #Python

If there is no any exceptions at TRY clause, the ELSE clause will be executed. #Python

DailyPythonTips's tweet image. If there is no any exceptions at TRY clause, the ELSE clause will be executed. #Python

Using compound statements in #Python is a good practice!

DailyPythonTips's tweet image. Using compound statements in #Python is a good practice!

Right way to use string split method in #Python.

DailyPythonTips's tweet image. Right way to use string split method in #Python.

Empty list ([ ]), zero (0), float zero ( 0.0 ), None and Empty String ( "") always evaluate to False. #Python

DailyPythonTips's tweet image. Empty list ([ ]), zero (0), float zero ( 0.0 ), None and Empty String ( "") always evaluate to False. #Python

Try to use all CAPS_AND_UNDERSCORE to identify constants in #python

DailyPythonTips's tweet image. Try to use all CAPS_AND_UNDERSCORE to identify constants in #python

Checking whether two objects (lists, dictionaries, custom objects) you created are equal or not is called a test of identity in #Python.

DailyPythonTips's tweet image. Checking whether two objects (lists, dictionaries, custom objects) you created are equal or not is called a test of identity in #Python.

Use get() method in #Python's dictionary to return a default value if key is not found. #programming

DailyPythonTips's tweet image. Use get() method in #Python's dictionary to return a default value if key is not found. #programming

Comparisons can be chained arbitrarily in #python. x < y <= z is equivalent to x < y and y <= z


Loading...

Something went wrong.


Something went wrong.