Explanation for re.split() error?
<p>I'm sure you see this a lot but just wanted to warn you that I'm still very new to coding in general and have a lot to learn. I've been attempting teaching myself by working on a personal project and youtube whenever I have the time. </p>

<p>Long version: I always get an error when I use the split function, but I still get a value. Essentially what my function is supposed to do is take an angle or bearing that is in degreesÂ°minutes'seconds" or for example "N 38Â°43'23\" E" to a decimal number. I took advantage of bearings being less than 90 degrees to use indexing to find the numbers in the string to convert the angle. However, if the angle wasn't a bearing, I couldn't think of a way to figure out how many tens places the degrees to pull the number out so I tried splitting it at the degree symbol. When it does this, though, it returns an error saying split() requires a non-empty pattern match. What does this mean? The code still works, but always returns this error with it.</p>

<p>Short version: Here's my code:</p>

<pre><code>def decimal(x):  # converts degrees-minutes-seconds to decimal
    dms = list(x)
    if dms[0] == 'N' or dms[0] == 'S':
        degrees = ((int(dms[2]) * 10) + int(dms[3]))
        minutes = ((int(dms[-8]) * 10) + int(dms[-7])) / 60
        seconds = ((int(dms[-5]) * 10) + int(dms[-4])) / 3600
    else:
        placeholder = re.split(r'\u00b0*', x)
        degrees = int(placeholder[0])
        minutes = ((int(dms[-6]) * 10) + int(dms[-5])) / 60
        seconds = ((int(dms[-3]) * 10) + int(dms[-2])) / 3600
    return degrees + minutes + seconds    
</code></pre>

<p>When I run it, I get the decimal number, but I also get:</p>

<pre><code>FutureWarning: split() requires a non-empty pattern match. 
  return _compile(pattern, flags).split(string, maxsplit)
</code></pre>

<p>I've looked at other questions posted about this error, but there were no answers that explained what to do to avoid this, or what the error really means. Thank you for any help. Also any advice or corrections you see would be greatly appreciated!</p>

<p>What you have is not an error, it's a warning.</p>

<p>For one, I think you should not use a raw string, you need <code>'\u00b0'</code>, the character. And <code>'c*'</code> will match 0 or more of <code>c</code>, so it matches the empty string. I believe this is what the warning is about. I suggest that you use</p>

<pre><code>re.split('\u00b0', x)
</code></pre>

<p>Or even better, just</p>

<pre><code> x.split('\u00b0')
</code></pre>

python split