Jan-11-2020, 01:59 AM
Thank you guys for the help!
I'm moving forward with your tips, but it breaks me another issue.
Thank you again!!
PS.: I liked the way to open the file using 'with'.
I'm moving forward with your tips, but it breaks me another issue.
f = open("file.txt", "r") for line in f: for item in line.split(' '): if "NET" in item.upper(): print(line) else: pass f.close()When I open a .txt with more data the return of this code is the error below at PyCharm:
Error:File "C:\Users\Lzr\AppData\Local\Programs\Python\Python37-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 4748: character maps to <undefined>
I'm wondering there is something wrong in the .txt file but there will be a way to treat this "decode" error. Thank you again!!
PS.: I liked the way to open the file using 'with'.