Issue 26430: quote marks problem on loaded file
Created on 2016-02-24 19:13 by quetzal, last changed 2022-04-11 14:58 by admin. This issue is now closed.
| Messages (7) | |||
|---|---|---|---|
| msg260826 - (view) | Author: quetzal (quetzal) | Date: 2016-02-24 19:13 | |
impossible to match a string pattern with a quotation mark in an opened file
[code]
file = '''it's an opened file made of "strings"'''
if '''"string"''' in file:
____print('ok')
else:
____print('none')
[/code]
in iddle, it works with no difficulties...
but if the file comes from an file = open(fileadress).read()
the same code return nothing... it do not find the pattern string, and just because of double quote marks (i've not tried with some other marks)
for me it's a bug, because it do works well, if their no quotation marks
|
|||
| msg260827 - (view) | Author: quetzal (quetzal) | Date: 2016-02-24 19:16 | |
the word "string" got an "s" for sure, or it will not match it... but the problem is not about typography :D |
|||
| msg260828 - (view) | Author: SilentGhost (SilentGhost) * ![]() |
Date: 2016-02-24 19:21 | |
Could you please upload the test file that would allow us to reproduce this behaviour. |
|||
| msg260830 - (view) | Author: quetzal (quetzal) | Date: 2016-02-24 20:03 | |
well, silentghost... a .txt file, or an .html and that's all... if there's some text into... just find a pattern with some - " -
import the file in python(iddle)
and type :
if '''pattern''' in file:
__ print('ok')
else:
__ print('none')
i don't think that a file is really necessary... you'll do certainly better than me in testing...
|
|||
| msg260832 - (view) | Author: SilentGhost (SilentGhost) * ![]() |
Date: 2016-02-24 20:07 | |
OK, sorry, but this is just nonsense. What most likely happens in your case is that the file doesn't contain a standard ASCII double quote, but one of it's fancy siblings. For the note: I did test and naturally wasn't able to reproduce this. |
|||
| msg260835 - (view) | Author: quetzal (quetzal) | Date: 2016-02-24 21:49 | |
thanks silentghost for tested it... i'm gonna try to see what happened be there... |
|||
| msg260839 - (view) | Author: quetzal (quetzal) | Date: 2016-02-25 05:40 | |
solution found. as Silentghost was saying, the problem was in the encoding of the quotemarks... and somes other /ecute and web encoding... unseeabble directly in my navigator, and not directly in free-access by a simple xxx.replace(a,b)... the translation was not complete, and i omit to verify it before to come here... sorry... but it was really weird |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:58:27 | admin | set | github: 70617 |
| 2016-02-25 05:40:29 | quetzal | set | messages: + msg260839 |
| 2016-02-24 21:49:15 | quetzal | set | messages: + msg260835 |
| 2016-02-24 20:07:52 | SilentGhost | set | status: open -> closed resolution: not a bug messages: + msg260832 stage: resolved |
| 2016-02-24 20:03:28 | quetzal | set | messages: + msg260830 |
| 2016-02-24 19:21:26 | SilentGhost | set | nosy:
+ SilentGhost messages: + msg260828 |
| 2016-02-24 19:16:56 | quetzal | set | messages: + msg260827 |
| 2016-02-24 19:13:36 | quetzal | create | |
