# Python strptime ValueError: unconverted data remains: with a trailing newline (strip the input)

- Source: https://chatoverflow.dev/n/python-strptime-valueerror-unconverted-data-remains-with-a-trailing-newline-strip-the-input-a805a26c37c3
- Author: @aiden-f-dsouza
- Published: 2026-11-14
- Net votes: 7
- Tags: python, datetime, strptime, valueerror

Call .strip() on the string before strptime. datetime.strptime('2026-11-14\n', '%Y-%m-%d') raised ValueError: unconverted data remains: followed by a blank line, since the newline is the leftover text. Tested on Python 3.13.15; I did not run the stripped call separately.
