Dave Carlson · @beepcheck
0 followers · 6 posts · Server fosstodon.org

when using the ipython terminal, put a question mark after a method or class name to bring up the docstring, like:

`print?`

gives

```python
In [1]: print?
Signature: print(*args, sep=' ', end='\n', file=None, flush=False)
Docstring:
Prints the values to a stream, or to sys.stdout by default.

sep
string inserted between values, default a space.
end
string appended after the last value, default a newline.
file
a file-like object (stream); ...
```

#pythontips

Last updated 1 year ago

Peng Qian · @qtalen
2 followers · 4 posts · Server me.dm

Just published an article on @towardsdatascience about breaking performance bottlenecks with aiomultiprocess!💡 Check out my practical guide filled with code examples and best practices.
towardsdatascience.com/superch

#python #datascience #machinelearning #concurrency #pythontips

Last updated 1 year ago

Luis Márquez :verified: · @luismarquez
18 followers · 351 posts · Server techhub.social

🐍 El método sort() ordena los elementos de una lista en orden ascendente o descendente.

Es muy útil para organizar datos y hacer búsquedas más rápidas

#pythontips #python #programacion

Last updated 2 years ago

Harim Britto · @harimbritto
84 followers · 933 posts · Server mastodon.social

Bom dia meu povo!

Tô aproveitando as férias pra começar a mexer em algumas coisas do .

Surgiu um problema. Quando faço o login e senha pelo selenium, fico preso naquela tela de https e não consigo passar adiante.

Alguma dica?

#python #mastohelp #pythontips #bolhaDev

Last updated 2 years ago

Python quiz

a. [1, 4]
[1, 4, 5]

b. [1, 4, 5]
[1, 4, 5]

c. [1, 4]
[1, 4]


#python #pythonprogramming #pythontips #programmer #python3 #pythonquiz

Last updated 2 years ago

🐍 "else" statement can be used in both for loops and while loops also

How does it work?

▶️ Executed only if the loop completes normally

▶️ If the loop is terminated by a "break" statement,"else" block won't be executed

Example syntax:

####
for i in range(10):
print(i)
else:
print("for loop ended without break ")
####

This will print 0 to 9 then prints the "for loop ended without break"

--

▶️ In this code snippet(of the image), we generate random number(n) between 1 to 10.

▶️ We loop through the list

▶️ If the "n" matches with the list's index,it will "break" the loop. In that case it won't execute else

▶️ If the 'n' didn't match with any index,it will execute "else"


#python #pythonprogramming #pythontips #python3

Last updated 2 years ago

🌀What is wrong with the following python code snippet

#▪️▪️▪️
l =["c"
"py",
"js"
]
#▪️▪️▪️

We missed the comma after "c". The python will concatenate it with py. Resulting in ["cpy","js"].

#python #pythontips #pythonprogramming #python3

Last updated 2 years ago

Simple python quiz

A. Line number 2 has invalid syntax. It should be "quiz[2]"

B. It will print ('hello', 'world')

C. Linux number 1 will give an error, we can't mix string with integer in tuple


#python #pythonprogramming #pythontips #pythoncoding #pythoninterviews

Last updated 2 years ago

When and how to use the python "async" feature properly? -written by @guilatrova

▶️ Async only makes sense if you're doing IO

▶️ ZERO benefit in using async to stuff like CPU intensive work

Read more about it here

guicommits.com/effective-pytho


#async #python #python3 #programming #pythonprogrammer #pythonlessons #pythontutorial #pythontips

Last updated 2 years ago

DeaDSouL :fedora: :fediverse: · @DeaDSouL
162 followers · 369 posts · Server fosstodon.org

Since most of the resources in python need to be closed, so stop trying to close them manually. Instead, use their context manager.

#pythontips #python #python3 #coding #tips

Last updated 2 years ago

DeaDSouL :fedora: :fediverse: · @DeaDSouL
141 followers · 357 posts · Server fosstodon.org

When you're working with files use `with`

#pythontips #python #python3 #coding #tips

Last updated 2 years ago

DeaDSouL :fedora: :fediverse: · @DeaDSouL
144 followers · 361 posts · Server fosstodon.org
El Blog de Lázaro · @elblogdelazaro
282 followers · 2570 posts · Server mastodon.social

Learn Python Identity Operator and Difference Between “==” and “IS” Operator tecmint.com/learn-python-ident

#pythonprogramming #pythontips #python

Last updated 5 years ago