I am new to Python, and I kept getting an error that I cannot figure out. I first created a string for the example:
g = "Okay, let's create a line of text here for the example."
Then, I ran the following line and it gave me the correct answer:
g.split()[0].strip(',')
'Okay'
However, when I added in the input argument name, it gave me an error message
g.split()[0].strip(chars=',')
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-284-b2d7ee2c8c2c> in <module>
----> 1 g.split()[0].strip(chars=',')
TypeError: strip() takes no keyword arguments
Am I not allowed to include the input variable name? Python seems to be okay with it when I did that for split()
:
g.split(sep = ',')
['Okay', " let's create a line of text here for the example."]
Thank you for your help in advance.