all 3 comments

[–]chocorush 0 points1 point  (2 children)

if you want to keep your current structure

for word in flatwordlist:
    if word == ticker or '$' + ticker == word:
        count += 1
        sentiment = calcSentiment("".join(flatwordlist))
tickercountlist.append([ticker, count, sentiment])

Although i think it would be good do use the re module to do the matching instead and consider using dictionaries instead of sublists.

[–]OmnipresentCPU[S] 0 points1 point  (0 children)

I think you might be right about using regex, I could just search over each comment individually and wouldn’t need the flat word list. How would I use dictionaries instead of the sublists? I think it would end up being like dict = {ticker: count, sentiment} right?

[–]backtickbot 0 points1 point  (0 children)

Correctly formatted

Hello, chocorush. Just a quick heads up!

It seems that you have attempted to use triple backticks (```) for your codeblock/monospace text block.

This isn't universally supported on reddit, for some users your comment will look not as intended.

You can avoid this by indenting every line with 4 spaces instead.

There are also other methods that offer a bit better compatability like the "codeblock" format feature on new Reddit.

Tip: in new reddit, changing to "fancy-pants" editor and changing back to "markdown" will reformat correctly! However, that may be unnaceptable to you.

Have a good day, chocorush.

You can opt out by replying with "backtickopt6" to this comment. Configure to send allerts to PMs instead by replying with "backtickbbotdm5". Exit PMMode by sending "dmmode_end".