Re: strptime for different languages

2019-12-18 Thread Tobiah
A couple of point about your code: 1. Don't use a bare 'except' because it'll catch _any_ exception. See what exception strptime will raise and catch only that. I'm well aware of this, but I was too lazy to write something to generate the exception to find out what datetime would throw in th

Re: strptime for different languages

2019-12-18 Thread MRAB
On 2019-12-18 18:12, Tobiah wrote: What I tried is a cascade of try's: try: d = strptime(date_string, format_string_1) except: try: d = strptime(date_string, format_string_2) except: try: d = strptime(date_string, format_string_3) except: ... This is not

Re: strptime for different languages

2019-12-18 Thread Tobiah
What I tried is a cascade of try's: try: d = strptime(date_string, format_string_1) except: try: d = strptime(date_string, format_string_2) except: try: d = strptime(date_string, format_string_3) except: ... This is not about dates, but for the above, I'd

Re: strptime for different languages

2019-12-17 Thread Chris Angelico
On Wed, Dec 18, 2019 at 5:57 AM Barry Scott wrote: > > > > > On 17 Dec 2019, at 10:37, Ulrich Goebel wrote: > > > > Hi, > > > > I need to interpret a date string to get a datetime object. That should be > > done with strptime from the module datetime. > > > > But I don't know enough about the lo

Re: strptime for different languages

2019-12-17 Thread Barry Scott
> On 17 Dec 2019, at 10:37, Ulrich Goebel wrote: > > Hi, > > I need to interpret a date string to get a datetime object. That should be > done with strptime from the module datetime. > > But I don't know enough about the locale settings from where the date sting > comes. Actually the date_s

Re: strptime for different languages

2019-12-17 Thread Ulrich Goebel
I think I have to live with this problem and the resulting date-errors. It seems to be possible to bring dateparse to better results if one knows a bit more about the source of a date string. Am 17.12.19 um 12:56 schrieb niktnobodyn...@gmail.com: W dniu wtorek, 17 grudnia 2019 11:47:23 UTC+1 u

Re: strptime for different languages

2019-12-17 Thread Ulrich Goebel
That's absolutely great, thank You! Am 17.12.19 um 11:53 schrieb Jon Ribbens via Python-list: On 2019-12-17, Ulrich Goebel wrote: I need to interpret a date string to get a datetime object. That should be done with strptime from the module datetime. But I don't know enough about the locale se

Re: strptime for different languages

2019-12-17 Thread niktnobodynikt
W dniu wtorek, 17 grudnia 2019 11:47:23 UTC+1 użytkownik Ulrich Goebel napisał: >13. Januar 1965 >13. January 1965 >13.01.1965 >1965-01-13 02.03.2000 Is it Mar, 2nd 2000 or Feb, 3rd 2000? -- https://mail.python.org/mailman/listinfo/python-list

Re: strptime for different languages

2019-12-17 Thread Jon Ribbens via Python-list
On 2019-12-17, Ulrich Goebel wrote: > I need to interpret a date string to get a datetime object. That should > be done with strptime from the module datetime. > > But I don't know enough about the locale settings from where the date > sting comes. Actually the date_string cames from different c

strptime for different languages

2019-12-17 Thread Ulrich Goebel
Hi, I need to interpret a date string to get a datetime object. That should be done with strptime from the module datetime. But I don't know enough about the locale settings from where the date sting comes. Actually the date_string cames from different contact forms inside websites made by d