Sep-23-2021, 06:40 PM
(Sep-23-2021, 05:47 PM)Blue Dog Wrote: snippsat, that worked perfect. I looked up " line.strip()" and I still don't know how it worksOne thing that very useful in Python is take stuff out and test it interactively.
>>> # So when reading from file a new line(\n) is added >>> url = 'http://www.dnr.state.mi.us/spatialdatalibrary/pdf_maps/topomaps/Adair.pdf\n' >>> url 'http://www.dnr.state.mi.us/spatialdatalibrary/pdf_maps/topomaps/Adair.pdf\n' >>> print(url) http://www.dnr.state.mi.us/spatialdatalibrary/pdf_maps/topomaps/Adair.pdf >>> # strip() take away \n >>> url = url.strip() >>> url 'http://www.dnr.state.mi.us/spatialdatalibrary/pdf_maps/topomaps/Adair.pdf' >>> print(url) http://www.dnr.state.mi.us/spatialdatalibrary/pdf_maps/topomaps/Adair.pdf >>>