[Tutor] new to python
Mats Wichmann
mats at wichmann.us
Mon Jul 24 19:33:15 EDT 2017
On 07/24/2017 04:32 PM, N6Ghost wrote:
> update code:
> f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')
> for line in f:
> for line in f:
> print(line.rstripe())
>
> f.close()
>
>
> C:\coderoot\python3\level1>python secondscript.py
> Traceback (most recent call last):
> File "secondscript.py", line 5, in <module>
> print(line.rstripe())
> AttributeError: 'str' object has no attribute 'rstripe'
You presumably meant 'rstrip' (strip from right) rather than 'rstripe'.
With errors like this, look in the documentation to see the available
methods:
https://docs.python.org/3/library/stdtypes.html#string-methods
More information about the Tutor
mailing list