Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 13891

Removing digits from each line of a file

$
0
0

I wish to write a code in Python which reads each line from a txt and whilst doing so takes each digit from that sentence and stores it in an array. Simultaneously, takes that new word and stores that one in another array.

I have been trying permutation of the following code:

while True:    content=file.readline()print (re.sub(pattern, '', content.file.readline())

with no success (Yes I do not have the array specified!! But if this loop does not work, what is the point of appending the content to an array?)


Viewing all articles
Browse latest Browse all 13891

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>