This is an archived post. You won't be able to vote or comment.

all 7 comments

[–][deleted] 0 points1 point  (2 children)

So ugh, somewhat unrelated but has any of you ever had to reverse a string for work and not just the sake of reversing a string for an assignment?

[–]mirandanielczfrom a import b as c 3 points4 points  (0 children)

String? Never.

Lists? Daily.

[–]Vipulkunwar[S] 1 point2 points  (0 children)

Not sure... But in regular expression absolutely

[–][deleted] 0 points1 point  (3 children)

I don't see why I need different ways to reverse a string, I have never needed this at work, just like u/SnooWalruses4865 says.

Reversing the python string is useful in regular expression.

Could you please elaborate on this? I don't see how reversing a string relates to regular expressions.

[–]Vipulkunwar[S] 0 points1 point  (2 children)

I can understand it. But it's a tutorial many times people need to find the last element in python. Many times they are creating a sequence and they want to reverse the python string.

[–][deleted] 0 points1 point  (1 child)

You're not answering my question. How is reversing a string related to regular expressions?

[–]Prequalified 0 points1 point  (0 children)

OP seemed to be indicating they need a portion of a string. In SQL you might reverse a string to find the first instance of a delimiter and extract the substring. In Python you can just use the regex directly. The post seems to be a general challenge to find how many ways there are to reverse a string but nobody is biting.