I am not a big fan of Python, (bad experiences with white space dependent languages) but is there a reason you don't use Python's Regular Expression. RegEx is hugely helpful and might help you more easily understand what you were trying to do if you have to come back to it.
Python RegEx
import re
#test data
data = '#test v/test test'
data2 = '#test v/test'
data3 = '#v/test test'
data4 = '#mess up your test!# v/test test'
if data.find('v/') != -1:
match = re.search('v/(\w*)', data)
for group in match.groups():
Send(str('voat.co/v/') + group)
2
24 Jan 2016 22:59
u/AStoney
in v/programming
I like to think that questioning your own coding skill is a big part of not being in that group. Sure you are going to make mistakes, but you are far more likely to refactor and fix a potential mess if you are self conscious about your code. The ones that say "Who cares?" or "No one will ever look at it" are the ones you want to avoid.
2
15 Jul 2015 05:02
u/AStoney
in v/programming
I am not a big fan of Python, (bad experiences with white space dependent languages) but is there a reason you don't use Python's Regular Expression. RegEx is hugely helpful and might help you more easily understand what you were trying to do if you have to come back to it.
Python RegEx