programming hub programming hub - 26 days ago 10
Python Question

I want to split a text by dot and space, the code is posted its giving me an error "str object cannot be interpreted as an integer"

the code is posted its giving me an error "str object cannot be interpreted as an integer" is there anyone who can fix ?

file = open(r'C:\Users\Raja Arsalan\Desktop\read_file.txt')


for i in file:
words= i.rstrip()
print("FRIST WORD" ,words)

letter = words.split("."," ")
print(letter)

Answer Source

import re file = open(r'C:\Users\Raja Arsalan\Desktop\read_file.txt')

for i in file: words= i.rstrip() print("FRIST WORD" ,words)

 #letter = words.split(".")#," ")
 letter = re.split('. |  ',words)
 print(letter)