Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor urllib.url2pathname #39

Open
cpanse opened this issue Feb 9, 2021 · 0 comments
Open

refactor urllib.url2pathname #39

cpanse opened this issue Feb 9, 2021 · 0 comments

Comments

@cpanse
Copy link
Collaborator

cpanse commented Feb 9, 2021

result=regex0.match(urllib.url2pathname(line.strip()).replace('\\',"/").replace("//","/"))

make it python3 work

Python 2.7.16 (default, Dec 21 2020, 23:00:36) 
[GCC Apple LLVM 12.0.0 (clang-1200.0.30.4) [+internal-os, ptrauth-isa=sign+stri on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> import sys
>>> import urllib
>>> regex0 = re.compile("^title=.*(p([0-9]+).+Proteomics.*(raw|RAW|wiff)).*")
>>> line="title=File%3a%20%22S%3a%5cp23874%5cProteomics%5cQEXACTIVE_2%5canalytic_20210121%5c20210121_C23874_012_S282311_BC6%2eraw%22%20%3b%20SpectrumID%3a%20%2273256%22%3b%20scans%3a%20%2240490%22"
>>> result=regex0.match(urllib.url2pathname(line.strip()).replace('\\',"/").replace("//","/"))
>>> result
<_sre.SRE_Match object at 0x109ae7ae0>
>>> result.group(1)
'p23874/Proteomics/QEXACTIVE_2/analytic_20210121/20210121_C23874_012_S282311_BC6.raw'
>>> result
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant