Print the string, if string in the line ends with specific characters
<p>How do I print every string that ends on 'je' in a line</p>

<p>For example : </p>

<pre><code>for line in sys.stdin:
    for string in line:
        if string ends with 'je':
            print string
</code></pre>

<p>And only if the string ends with '....je' , so no 'je' included. And if the string ends with '....je?' or '....je.' remove '? , . ' . Then it should print the string. Help would be appreciated.</p>

<p>Assuming that your string name dosent allow '?,.' at all, it should work.</p>

<pre><code>for line in sys.stdin:
    for string in line:
        string = string.strip('.,?')
        if string.endswith('je'):
            print(string)
</code></pre>

python string file character line