Every line of 'python chomp' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
70 def lchomp(s, c): 71 if s[:1] == c: 72 return s[1:] 73 return s
Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code
428 def test_chomp(self, space): 429 assert space.str_w(space.execute('return "hello".chomp')) == "hello" 430 assert space.str_w(space.execute('return "hello\\n".chomp')) == "hello" 431 assert space.str_w(space.execute('return "hello\\r\\n".chomp')) == "hello" 432 assert space.str_w(space.execute('return "hello\\n\\r".chomp')) == "hello" 433 assert space.str_w(space.execute('return "hello\\r".chomp')) == "hello" 434 assert space.str_w(space.execute('return "hello \\n there".chomp')) == "hello \n there" 435 assert space.str_w(space.execute('return "hello".chomp("llo")')) == "he" 436 w_res = space.execute('return "hello".chomp!') 437 assert w_res is space.w_nil 438 w_res = space.execute('return "".chomp!') 439 assert w_res is space.w_nil