Removing first character in a String leaves whitespace
<p>I have a textfile that looks like this:</p>

<pre><code>6 Hello World
</code></pre>

<p>I'm reading it in as such:</p>

<pre><code>with open("test.txt") as fp:
    for line in fp:
        l = line.split(" ")
        print(l)
</code></pre>

<p>Which prints me the entire string:</p>

<pre><code>6 Hello World
</code></pre>

<p>I want to remove the '6' character, and just store the string 'Hello World' in another string:</p>

<p>I've done this</p>

<pre><code>newStr = l.replace(l[0],"")
</code></pre>

<p>Which now gives me:</p>

<pre><code> Hello World
</code></pre>

<p>Now I want to remove the leading space, and store the string.
I tried this:</p>

<pre><code>newStr2 = newStr.replace(newStr[0],"")
print(newStr2)
</code></pre>

<p>But this prints:</p>

<pre><code>HelloWorld
</code></pre>

<p>Instead of <code>Hello World</code> (no leading space character)
What am I doing wrong here?
Also, using len() on newStr2 tells me the length is 11, even though it's 10. Is len() including a newline character?</p>

<p>An alternative, if you want to skip the replacing altogether (and assuming that all of your data follows this pattern) is just to take everything from the second element of the list returned by the <code>.strip()</code> on, using <code>join</code> and slicing, as in:</p>

<pre><code>l = " ".join(line.split(" ")[1:])
</code></pre>

python