How to implement custom String Formatting in Python

preview_player
Показать описание
How to implement custom String Formatting in Python

📓 ML Notebooks available on Patreon:

If you enjoyed this video, please subscribe to the channel:

~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

#Python shorts
Рекомендации по теме
Комментарии
Автор

Wow, mind is blow in less then a minute

okoeroo
Автор

Thank you :-) Using this, I have now simplified printing various common class summaries using `event.event_summary(...)`, some of which needed 4 lines of params, to `{event:f}` or `{event:n}`, etc.

Julie
Автор

It might be a stupid question but can you use this __format__ method to escape/sanitise/build SQLinjected input Or is this too risky, not the intent of this method.

jordymaryns
Автор

This was very easy to understand, thank you for inspiring me to learn more about PYthon's wonderful syntax

swiftlydidit
Автор

Bro u nailed it. Thanks for the Awesome content

eswarreddy
Автор

Thanks! idk from u find these or if i'll ever be able to remember these on time i need them... but still very informative!

Redditard
Автор

Could u explain me the first code
What x:.2f does?

aneekdas
Автор

hey patrick in reza i had serious problem in python
i really appreciate if u help me

i just have this line which get six argument as coordinate of two point of a element (Xi, Yi, Zi, Xj, Yj, Zj ) :

SapModel.LinkObj.AddByCoord(Xi, Yi, Zi, Xj, Yj, Zj)

my ideal is import these coordinates from excel by line like this :
pd.read_excel("D:\Thesis\Model\coordinate.xlsx", sheet_name="RezaSheet", header=None, na_values=["NA"], usecols=":", skiprows=range(), nrows=)
it doesn't work but can u tell me how can i implement these six into first line

rezasharifi
Автор

Instead of the if statement how about a dict

alexandarjelenic