On 06/07/2018 04:21 PM, Roger Lea Scherer wrote:
> I've given up again. I've tried the python documentation, I've tried to
> implement the above suggestions, I've tried the translate thing with a
> table that I did not include this time because I couldn't get it to work,
> I've looked at StackOverf
On 07/06/18 23:21, Roger Lea Scherer wrote:
> they won't. I've started from scratch again.
>
> **
> import string
>
> gettysburg =
> open("C:/Users/Roger/Documents/GitHub/LaunchCode/gettysburg.txt", "r")
>
> puncless = ""
> for char in gettysburg:
I think this is wrong. gettysburg is a
I've given up again. I've tried the python documentation, I've tried to
implement the above suggestions, I've tried the translate thing with a
table that I did not include this time because I couldn't get it to work,
I've looked at StackOverflow, Quora and another website, so many things
seem so pr
Neil Cerutti wrote:
> punctuation_removal_table = str.maketrans({c: None for c in
> string.punctuation})
Alternative spellings:
>>> from string import punctuation
>>> (str.maketrans({c: None for c in punctuation})
... == str.maketrans(dict.fromkeys(punctuation))
... == str.maketrans("", "", pu
Op 11 mei 2018 21:43 schreef Neil Cerutti :
On 2018-05-10, Albert-Jan Roskam wrote:
> If a punctuation symbol is in your string: Replace that symbol
> with an empty string.
>
>=>>> maybe something like
>
> import re
> no_interpunction = re.sub("[%s]" % re.escape(string.punctuation), '',
> sen
On 2018-05-10, Albert-Jan Roskam wrote:
> If a punctuation symbol is in your string: Replace that symbol
> with an empty string.
>
>=>>> maybe something like
>
> import re
> no_interpunction = re.sub("[%s]" % re.escape(string.punctuation), '',
> sentence)
str.translate can be used instead of re
Verzonden vanaf mijn Samsung Galaxy-smartphone.
Oorspronkelijk bericht
Van: boB Stepp
Datum: 10-05-18 21:53 (GMT+08:00)
Aan: tutor
Onderwerp: Re: [Tutor] Iteration issues
On Wed, May 9, 2018 at 6:27 PM, Roger Lea Scherer wrote:
> Hello, again.
>
> I want to co
On 05/09/2018 05:27 PM, Roger Lea Scherer wrote:
> Hello, again.
>
> I want to count words in a text file. If a word repeats I want to increase
> the count by 1; if the word is new to the dictionary, I want to add the
> word to the dictionary. Everything works like I would like and expect,
> excep
On Wed, May 9, 2018 at 6:27 PM, Roger Lea Scherer wrote:
> Hello, again.
>
> I want to count words in a text file. If a word repeats I want to increase
> the count by 1; if the word is new to the dictionary, I want to add the
> word to the dictionary. Everything works like I would like and expect,
On 05/09/2018 05:27 PM, Roger Lea Scherer wrote:
> Hello, again.
>
> I want to count words in a text file. If a word repeats I want to increase
> the count by 1; if the word is new to the dictionary, I want to add the
> word to the dictionary. Everything works like I would like and expect,
> excep
Greetings!
On Wed, May 9, 2018 at 6:27 PM, Roger Lea Scherer wrote:
> Hello, again.
>
> I want to count words in a text file. If a word repeats I want to increase
> the count by 1; if the word is new to the dictionary, I want to add the
> word to the dictionary. Everything works like I would like
Hello, again.
I want to count words in a text file. If a word repeats I want to increase
the count by 1; if the word is new to the dictionary, I want to add the
word to the dictionary. Everything works like I would like and expect,
except for it only adds the last word of each line to the dictiona
12 matches
Mail list logo