Python short course: Some type-specific methods for string in Python

 Some type-specific methods for string



In [1]: s = 'spam'

In [2]: s.find('pa')
Out[2]: 1

In [3]: s
Out[3]: 'spam'

In [4]: s.replace('pa', 'xyz')
Out[4]: 'sxyzm'

In [5]: s
Out[5]: 'spam'

Comments

Popular posts from this blog

Lab's weekly topic - week 50 2023 - Detailed explanation for encoder of U-Net

Lab's recommendation: Awesome books to learn machine learning and AI (continue updating)