r/pythontips • • Sep 23 '21

Data_Science 15 Must-Know Python String Methods

Python is a great language. It is relatively easy to learn and has an intuitive syntax. The rich selection of libraries also contribute to the popularity and success of Python. Visit here: https://www.thinkdataanalytics.com/python-string-methods/

41 Upvotes

5 comments sorted by

View all comments

3

u/expressadmin Sep 23 '21

Would somebody give an example as to when you would want to use partition? I've heard of it before but never seen it used and struggle to think of a use case where I would use it.

5

u/[deleted] Sep 23 '21

I have had a bulky coin/pair csv files. Tons of exchange names (FTX,BINANCE etc.) and pairs (BTC/USDT etc.) .

BINANCE  :  BTC/USDT,ETH/USDT,LTC/USDT,NEO/USDT,BTC/USDT....
BITFINEX :  BTC/USD,ETH/USD,LTC/USD,AID/USD,BAT/USD,BTC/USD....

And these strings contains 2 part. Spot and futures. But while I was scraping forgot to separate them and results were confusing. I had 2 same pair at each exchange? So I had to split them. And I tought I could easily separate them to tuple. End of the script I get results like this:

BINANCE  : SPOT-> .... , FUTURES-> ....
BITFINEX : SPOT-> .... , FUTURES-> ....

I hope it is clear. Have a nice day!