Get strings list in python with regex [duplicate]

2024/11/22 3:18:02

I want extract strings from this text with regex:

¬~ZCC÷0¬ZAF÷~World¬~AA÷Eef~RZgth¬AD¬~AA÷jaKNedK8¬AD÷1502690‌​400¬ADE÷~1502690400

expected output:

['ZCC÷0¬ZAF÷~World','AA÷Eef~RZgth¬AD','AA÷j‌​aKNedK8¬AD÷150269040‌​0¬ADE÷~1502690400']

the delimiter is

¬~

Thankyou

Answer

For this task using a regex is a bit overkill. Just use the split() method

string = "¬~ZCC÷0¬ZAF÷~World¬~AA÷Eef~RZgth¬AD¬~AA÷jaKNedK8¬AD÷1502690‌​400¬ADE÷~1502690400"
x = string.split("¬~")
print(x)
https://en.xdnf.cn/q/120710.html

Related Q&A

python static code analysis tools - code analysis (preliminary research question) [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.Want to improve this question? Update the question so it focuses on one problem only by editing this post.Closed 3…

how can I get all post of users in django [closed]

Closed. This question needs debugging details. It is not currently accepting answers.Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to repro…

Python 3: Getting IndexError: list index out of range on shuffle method

Im building a blackjack command line game and Ive run into a snag. The shuffle feature on my deck class object keeps coming up with IndexError: list index out of range on line 29. It is a sporadic bug…

How to encrypt a file

Just trimmed this down big timeI have an overall assignment that must read a file, encrypt it and then write the encrypted data to a new file.what ive tried is this:filename=input("Enter file name…

Any Idea on how Should I analyze this Algorithm? [closed]

Its difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying thi…

Syntax error ; multiple statements found while

Why is there this syntax error Multiple statements found while compiling a single statement given when I run this code? Answer and help will be super appreciated for this python newbie here

No module named PyPDF2._codecs, even after already installed

I have installed PyPDF2==2.3.0, but I still get the error below when I import PyPDF2. The error message is:ModuleNotFoundError: No module named PyPDF2._codecs

rearding regex (python) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.Closed 10 years ago.Improv…

While Loop Guessing Number Game - Python

Im trying to make a guess the number between 1-10 game but the while loops seems to keep running. I want to program to let the user guess a number then display if its too high or low etc then start aga…

Calculating distance between word/document vectors from a nested dictionary

I have a nested dictionary as such:myDict = {a: {1:2, 2:163, 3:12, 4:67, 5:84}, about: {1:27, 2:45, 3:21, 4:10, 5:15}, apple: {1:0, 2: 5, 3:0, 4:10, 5:0}, anticipate: {1:1, 2:5, 3:0, 4:8, 5:7}, an: {1:…