RUVIDEO
Поделитесь видео 🙏

Python Tips and Tricks: Every Python Programmer Must Know

Here are some cool tips and tricks which is used while making a project or program.

10. Adding 2 list :
for this you just have to create 2 list and then combine them in 2 variables. i.e. a=[1,2,3] b=[4,5,6] then c=a+b. Now c can hold 2 list.

9: Calendar:
In this trick you can print calendar according to calendar format like import calendar then print calendar.month(2017,1) you can also pass variable to it according to your format.

8: Swap:
In other languages you have to write multiple lines of code for it but in Python you can just do it by single line i.e a,b=b,a that's the beauty of python.

7: List:
In python you can convert any string into list by using list function i.e a='abcd' then a=list(a). If your list contains integer values then just convert it by using str() function i.e a=123 then a=str(a) now you can convert it into list.

6: Join:
You can join list elements by using join function i.e. ''.join(msg) also if you pass any value within '' then it join with all elements.

5: Date Time:
This is the essential thing for programmer to show it any project or program just import datetime module and call the function and print it (by watching the video) also you can change the format of it %d for date, %m for month, %y for year, %I for hour, %M for minute, %s for second, %p for 12 hour.

4. Random :
using random function is essential in making games, cryptography,projects etc , in python import random module and select your random value via random.choice(variable). You can also select list or any type of value.

3: Color :
A program can become more attractive if it has a beautiful color in it. Just import os module and put os.system('color A') and set color according to you.
Color code in os are:
0: black
1: blue
2: green
3: aqua
4: red
5: purple
6: yellow
7:white
8: gray
9: light blue
A: light green
B: light aqua
C: light red
D: light purple
E: light yellow
F: Bright white

2: Compress:
Sometimes you have to compress your messages or values in your program, by python you can do it eaisly, Just import zlib module and pass your message in zlib.compress(msg), it compress your msg, to decompress just use zlib.decompress(msg) to decompress it.

1: Message Box:
To make a program user friendly, this is very useful, just import ctypes and write ctypes.windll.user32.MessageBoxA(0,'Your Message','Message title',0) here 0 is for ok button. You can also use tkinter but i like this though.


Support me to develop more new free cool stuff: https://www.paypal.me/sandeeppushp


So guys that's all in this video. Hope you like it .
Thumbs up if you like it and subscribe to get more new stuff.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Python Tips and Tricks: Every Python Programmer Must Know», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.