That said, what remains mystery is why the original one worked this morning.
Strange!
On Wed, Aug 5, 2020 at 10:15 PM Michio Suginoo
wrote:
> Hi Bob and MRAB,
> Both of you, very kind.
> Thanks.
> I tried with DataFrame as my original code, but this time, I inserted
> regex=True and it worked.
Hi Bob and MRAB,
Both of you, very kind.
Thanks.
I tried with DataFrame as my original code, but this time, I inserted
regex=True and it worked.
Thank you very much!
Best
On Wed, Aug 5, 2020 at 9:50 PM Bob van der Poel wrote:
> I don't think that string.replace() has an option for a dictionary
I don't think that string.replace() has an option for a dictionary of
replacements ... mind you, it might be nice if it did. In the meantime,
have you tried looping through the dictionary and changing each possible
character?
On Wed, Aug 5, 2020 at 5:12 PM Michio Suginoo
wrote:
> Hi MRAB,
>
> S
Hi MRAB,
In addition,. I also found out the following does not work either in my
Jupyter Notebook.
correction_dic2={ "La Boca" : "BOCA", "La Paternal": "PATERNAL", "Villa
General Mitre": "VILLA GRAL. MITRE"}
df = df.replace({'Name' : correction_dic2})
This case, unlike the earlier case, is aiming
Hi MRAB,
Sorry, I simply do not understand the intention of your statement.
If .replace() does not do what I want to do: to replace all ' í ' with 'i'
in any form .
Could you advise me other means to do it?
I am still a learner, so I am not knowledgeable. But, I presume, this sort
of needs--to r
On 2020-08-06 00:06, Michio Suginoo wrote:
Hi MRAB,
Here is an example:
In the original dataframe, I have something like, 'Agronomía'. And I
try to transform it to 'Agronomia'.
In this case, I try to replace í with i: the former with a Spanish
accent, the latter without.
That's what you want
Hi MRAB,
Here is an example:
In the original dataframe, I have something like, 'Agronomía'. And I try to
transform it to 'Agronomia'.
In this case, I try to replace í with i: the former with a Spanish accent,
the latter without.
Thanks
Best
On Wed, Aug 5, 2020 at 8:00 PM MRAB wrote:
> On 2020-
On 2020-08-05 23:21, Michio Suginoo wrote:
Hi,
I have trouble with .replace() method in a Pandas DataFrame.
My code is something like this:
correction_dic1 = {'á': 'a', 'í': 'i', 'ú': 'u', 'ó': 'o'}
df = df.replace({'Name' : correction_dic1})
Basically, what I am trying to do here is to replace
On Tue, 03 Jul 2018 07:52:42 +0400, Abdur-Rahmaan Janhangeer wrote:
> .replace("a" or "b")
Oh I *wish* Python accepted that syntax to mean what you thought it meant.
That's a common error: a surprising number of beginners are fooled by how
close Python is to natural language and try writing th
On 03Jul2018 07:52, Abdur-Rahmaan Janhangeer wrote:
that's another oddity i wanted to clear
how do i know that string methods accept or and and in like .replace("a" or
"b")
i can't figure out how to deduce that it can accept that
Well, it accepts an expression like that, but it doesn't do wh
On Thu, Mar 17, 2016 at 5:39 AM, Joel Goldstick
wrote:
> can you show the complete code? It doesn't start with "{:02} I don't think
Actually, yes it does; I can confirm the OP's concern:
$ python3
Python 3.6.0a0 (default:ae76a1046bb9, Mar 17 2016, 05:45:31)
[GCC 5.3.1 20160121] on linux
Type "h
On Wednesday, March 16, 2016 at 1:53:45 PM UTC-5, Dan Strohl wrote:
> Actually, I think that was the complete code... give it a try...
>
> "{:02}".format("1")
>
> produces the error listed.
>
> I agree the error is not very clear, since the "=" was not
> passed, it seems like an incorrect error.
On 16.03.2016 19:53, Ben Finney wrote:
Do you think some better error message should be used?
Yes, I think that error message needs to be improved. Please file a bug
report in Python's issue tracker https://bugs.python.org/>.
For example a hint that "0" does work for the given argument.
I sug
On 3/16/2016 3:08 PM, Chris Angelico wrote:
On Thu, Mar 17, 2016 at 5:53 AM, Ben Finney wrote:
For example a hint that "0" does work for the given argument.
I suggest: “zero-padding only allowed for numeric types, not 'str'”.
That's very slightly misleading too; zero padding is perfectly le
27;=' and '0' padding are not allowed in string format specifiers"
> -Original Message-
> From: Python-list [mailto:python-list-bounces+d.strohl=f5@python.org]
> On Behalf Of Joel Goldstick
> Sent: Wednesday, March 16, 2016 11:39 AM
> Cc: python-list@p
can you show the complete code? It doesn't start with "{:02} I don't think
On Wed, Mar 16, 2016 at 2:34 PM, the.gerenuk--- via Python-list <
python-list@python.org> wrote:
> The following error message, makes it a bit hard to understand what went
> wrong
>
> >>> "{:02}".format("1")
> Traceback (
"the.gerenuk--- via Python-list" writes:
> The following error message, makes it a bit hard to understand what went wrong
>
> >>> "{:02}".format("1")
> Traceback (most recent call last):
> File "", line 1, in
> ValueError: '=' alignment not allowed in string format specifier
Meaning that the
On 3/16/2016 2:53 PM, Ben Finney wrote:
"the.gerenuk--- via Python-list" writes:
The following error message, makes it a bit hard to understand what went wrong
"{:02}".format("1")
Traceback (most recent call last):
File "", line 1, in
ValueError: '=' alignment not allowed in string form
On Wed, Mar 16, 2016 at 2:53 PM, Ben Finney
wrote:
> "the.gerenuk--- via Python-list" writes:
>
> > The following error message, makes it a bit hard to understand what went
> wrong
> >
> > >>> "{:02}".format("1")
> > Traceback (most recent call last):
> > File "", line 1, in
> > ValueError: '
On Thu, Mar 17, 2016 at 5:53 AM, Ben Finney wrote:
>> For example a hint that "0" does work for the given argument.
>
> I suggest: “zero-padding only allowed for numeric types, not 'str'”.
That's very slightly misleading too; zero padding is perfectly legal
as long as you force the alignment:
>>
On Thu, Mar 17, 2016 at 7:55 AM, Terry Reedy wrote:
> On 3/16/2016 3:08 PM, Chris Angelico wrote:
>>
>> On Thu, Mar 17, 2016 at 5:53 AM, Ben Finney
>> wrote:
For example a hint that "0" does work for the given argument.
>>>
>>>
>>> I suggest: “zero-padding only allowed for numeric types
On Saturday, September 28, 2013 11:17:19 AM UTC-7, Tim Chase wrote:
> [mercy, you could have trimmed down that reply]
>
>
>
> On 2013-09-28 10:43, cerr wrote:
>
> > On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote:
>
> >> import re
>
> >
>
> > Great, only I don't have the re
On Saturday, September 28, 2013 11:07:11 AM UTC-7, MRAB wrote:
> On 28/09/2013 18:43, cerr wrote:
>
> [snip]
>
> > Great, only I don't have the re module on my system :(
>
> >
>
> Really? It's part of Python's standard distribution.
Oh no, sorry, mis-nformation, i DO have module re availab
[mercy, you could have trimmed down that reply]
On 2013-09-28 10:43, cerr wrote:
> On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote:
>> import re
>
> Great, only I don't have the re module on my system :(
Um, it's a standard Python library. You sure about that?
http://docs
On 28/09/2013 18:43, cerr wrote:
[snip]
Great, only I don't have the re module on my system :(
Really? It's part of Python's standard distribution.
--
https://mail.python.org/mailman/listinfo/python-list
On Saturday, September 28, 2013 4:54:35 PM UTC, Tim Chase wrote:
> On 2013-09-28 09:11, cerr wrote:
>
> > I have a list of sentences and a list of words. Every full word
>
> > that appears within sentence shall be extended by i.e. "I
>
> > drink in the house." Would become "I in the ." (and
>
MRAB writes:
> On 28/09/2013 17:11, cerr wrote:
> > Hi,
> >
> > I have a list of sentences and a list of words. Every full word
> > that appears within sentence shall be extended by i.e. "I
> > drink in the house." Would become "I in the ." (and
> > not "I in the .")I have attempted it like thi
On 28/09/2013 17:11, cerr wrote:
Hi,
I have a list of sentences and a list of words. Every full word that appears within sentence shall be extended by i.e. "I
drink in the house." Would become "I in the ." (and not "I in the
.")I have attempted it like this:
for sentence in sentences:
On 2013-09-28 09:11, cerr wrote:
> I have a list of sentences and a list of words. Every full word
> that appears within sentence shall be extended by i.e. "I
> drink in the house." Would become "I in the ." (and
> not "I in the .")
This is a good place to reach for regular expressions. It com
eschneide...@comcast.net wrote:
> I wanted the program to stop only after all the letters were typed; why in
> the world would I try to write a program with blanks for each letter that
> seem intended to be filled, only to have it stop if the last letter is typed,
> or have to type each letter
I wanted the program to stop only after all the letters were typed; why in the
world would I try to write a program with blanks for each letter that seem
intended to be filled, only to have it stop if the last letter is typed, or
have to type each letter so many times until its processed? If you
I wanted the program to stop only after all the letters were typed; why in the
world would I try to write a program with blanks for each letter that seem
intended to be filled, only to have it stop if the last letter is typed, or
have to type each letter so many times until its processed? If you
In <89146bb1-fb60-4746-93e2-6cb59cfbc...@googlegroups.com>
eschneide...@comcast.net writes:
> Thanks. I am running into a bunch of problems with the following code, all
> of which are clear when running the program
No, they're not clear. We can see what the code does, obviously, but we
don't kn
eschneide...@comcast.net wrote:
> Thanks. I am running into a bunch of problems with the following code, all of
> which are clear when running the program
>
> import random
> letters='abcdefg'
> blanks='_'*len(letters)
> print('type letters from a to g')
> print(blanks)
> for i in range(len(let
On Wed, Aug 21, 2013 at 5:49 PM, wrote:
> Thanks. I am running into a bunch of problems with the following code, all of
> which are clear when running the program
Some of us don't have time to just execute arbitrary code in some safe
environment, so we'd REALLY rather you paste in the exceptio
Thanks. I am running into a bunch of problems with the following code, all of
which are clear when running the program
import random
letters='abcdefg'
blanks='_'*len(letters)
print('type letters from a to g')
print(blanks)
for i in range(len(letters)):
if letters[i] in input():
bla
eschneide...@comcast.net wrote:
> Is there also a way to have the code remember what I typed and not stop after
> the first letter the user types? For example, if I typed 'a' once, thus
> returning 'a__', and then typed in 'b', I want the code to return
> 'ab_' and so on. I wasn't clear
Is there also a way to have the code remember what I typed and not stop after
the first letter the user types? For example, if I typed 'a' once, thus
returning 'a__', and then typed in 'b', I want the code to return 'ab_'
and so on. I wasn't clear about this part in my original post. Tha
eschneide...@comcast.net wrote:
> I'm trying to replace the blank(_) with the letter typed in by the user,
> in the appropriate blank(_) spot where the letter should be (where is in
> the letters list).
>
> letters='abcdefg'
> blanks='_ '*len(letters)
> print('type letter from a to g')
> print(bl
On 20 Aug 2013 09:42, wrote:
>
> I'm trying to replace the blank(_) with the letter typed in by the user,
in the appropriate blank(_) spot where the letter should be (where is in
the letters list).
>
> letters='abcdefg'
> blanks='_ '*len(letters)
> print('type letter from a to g')
> print(blanks)
On Mar 19, 8:36 pm, Cathy James wrote:
> Dear All,
> I need some assistance with Python so that values in the "Name" field e.g.
> Murray - James - Leo can be labeled as:
>
> Murray
> James
> Leo
>
> with a new line replacing every dash.
>
> Basically I need the equivalent of this VB in Python:
> r
On 2013-03-19, Cathy James wrote:
> Dear All,
> I need some assistance with Python so that values in the "Name"
> field e.g. Murray - James - Leo can be labeled as:
>
> Murray
> James
> Leo
>
> with a new line replacing every dash.
>
> Basically I need the equivalent of this VB in Python:
> replac
On 03/19/2013 11:36 AM, Cathy James wrote:
Dear All,
I need some assistance with Python so that values in the "Name" field e.g.
Murray - James - Leo can be labeled as:
Murray
James
Leo
with a new line replacing every dash.
Basically I need the equivalent of this VB in Python:
replace ( [Name]
On Tue, Mar 19, 2013 at 11:36 AM, Cathy James wrote:
> Dear All,
> I need some assistance with Python so that values in the "Name" field e.g.
> Murray - James - Leo can be labeled as:
>
> Murray
> James
> Leo
>
> with a new line replacing every dash.
>
> Basically I need the equivalent of this VB
Thanks, uninstalling first worked.
:D
On Thu, Sep 15, 2011 at 3:06 AM, Micky Hulse wrote:
> On Wed, Sep 14, 2011 at 9:58 AM, Micky Hulse
> wrote:
>> Not sure if you got an answer yet, but this is how I would do it:
>> sudo pip install --upgrade
>> git+git://github.com/jedie/python-creole.git#e
On Wed, Sep 14, 2011 at 9:58 AM, Micky Hulse wrote:
> Not sure if you got an answer yet, but this is how I would do it:
> sudo pip install --upgrade
> git+git://github.com/jedie/python-creole.git#egg=python-creole
Having read your message more closely, it sounds like you did not
install the packa
Hello,
On Wed, Sep 14, 2011 at 1:44 AM, Alec Taylor wrote:
> I've installed a version of python-creole from pip. How do I upgrade
> it to the latest git version?
Not sure if you got an answer yet, but this is how I would do it:
sudo pip install --upgrade
git+git://github.com/jedie/python-creole
--editable=git+https://github.com/jedie/python-creole.git is not the right forma
t; it must have #egg=Package
On Wed, Sep 14, 2011 at 10:54 PM, One Murithi wrote:
> pip install -e
> On Wed, Sep 14, 2011 at 11:44 AM, Alec Taylor
> wrote:
>>
>> Good evening,
>>
>> I've installed a version of pyth
On Sep 8, 3:51 pm, gry wrote:
To elaborate(always give example of desired output...) I would hope to
get something like:
SELECT public.max(PUBLIC.TT.I) AS SEL_0 FROM (SCHM.T RIGHT OUTER JOIN
PUBLIC.TT ON (SCHM.T.I IS NULL)) WHERE (NOT(NOT((power(PUBLIC.TT.F,
PUBLIC.TT.F) = cast(ceil(( SEL
gry wrote:
> [Python 2.7]
> I have a body of text (~1MB) that I need to modify. I need to look
> for matches of a regular expression and replace a random selection of
> those matches with a new string. There may be several matches on any
> line, and a random selection of them should be replaced
* gry wrote:
> I might want to replace '(max|min|cos|sqrt|ceil' with "public.\1", but
> only with probability 0.7. I looked and looked for some computed
> thing in re's that I could stick and expression, but could not find
> such(for good reasons, I know).
> Any ideas how to do this? I would go
On 08/09/2011 20:51, gry wrote:
[Python 2.7]
I have a body of text (~1MB) that I need to modify. I need to look
for matches of a regular expression and replace a random selection of
those matches with a new string. There may be several matches on any
line, and a random selection of them should
Jack Bates wrote:
> I have two objects, and I want to replace all references to the first
> object - everywhere - with references to the second object. What can I
> try?
Another way of solving your *actual* problem.
"Replace all references to object1 with object2 instead" is a means to an
end, n
In John Gordon writes:
> In Jack Bates
> writes:
> > I have two objects, and I want to replace all references to the first
> > object - everywhere - with references to the second object. What can I
> > try?
> The simplest answer to your question is to assign object2 to object1
I think I ha
In Jack Bates
writes:
> I have two objects, and I want to replace all references to the first
> object - everywhere - with references to the second object. What can I
> try?
The simplest answer to your question is to assign object2 to object1
at the very beginning of your code, but that is a v
On 8/5/2011 12:37 PM Jack Bates said...
I have two objects, and I want to replace all references to the first
object - everywhere - with references to the second object. What can I
try?
Start with a proxy to your first and have it swap in to the second?
EMile
--
http://mail.python.org/mailma
On Fri, Aug 5, 2011 at 3:37 PM, Jack Bates wrote:
> I have two objects, and I want to replace all references to the first
> object - everywhere - with references to the second object. What can I
> try?
If using PyPy instead of CPython is an option, the "thunk" object
space's "become" function can
yes thanks both work nicely, I will ponder the suggestions.
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 5, 3:59 am, Martin De Kauwe wrote:
> Hi,
>
> So i want to replace multiple lines in a text file and I have reasoned
> the best way to do this is with a dictionary. I have simplified my
> example and broadly I get what I want however I am now printing my
> replacement string and part of the
How about creating a new string instead of replacing the original.
def replace_keys(text, replacements_dict):
text_list = text.split('\n')
new_text = ''
for line in text_list:
key=line.split('=')[0]
if key.strip() in replacements_dict:
new_text = new_text +
2011/4/5 Martin De Kauwe :
> Hi,
>
> So i want to replace multiple lines in a text file and I have reasoned
> the best way to do this is with a dictionary. I have simplified my
> example and broadly I get what I want however I am now printing my
> replacement string and part of the original express
On 8/23/2010 12:13 PM Emile van Sebille said...
On 8/23/2010 11:22 AM Alban Nona said...
Hi everybody,
I would like to know if its possible to modify a list of entry that is
define into a list and replace it by another list ?
I try this piece of code, but Im pretty sure I messed something:
htt
On 8/23/2010 11:22 AM Alban Nona said...
Hi everybody,
I would like to know if its possible to modify a list of entry that is
define into a list and replace it by another list ?
I try this piece of code, but Im pretty sure I messed something:
http://pastebin.com/HfdkGeB3
The code you posted
On 10 Αύγ, 01:43, MRAB wrote:
> Íßêïò wrote:
> > D:\>convert.py
> > File "D:\convert.py", line 34
> > SyntaxError: Non-ASCII character '\xce' in file D:\convert.py on line
> > 34, but no
> > encoding declared; seehttp://www.python.org/peps/pep-0263.htmlfor
> > details
>
> > D:\>
>
> > What does
On 10 Αύγ, 18:12, MRAB wrote:
> Νίκος wrote:
>
> [snip]
>
>
>
>
>
> > The ID number of each php page was contained in the old php code
> > within this string
>
> > PageID = some_number
>
> > So instead of create a new ID number for eaqch page i have to pull out
> > this number to store to the begi
Νίκος wrote:
[snip]
The ID number of each php page was contained in the old php code
within this string
PageID = some_number
So instead of create a new ID number for eaqch page i have to pull out
this number to store to the beginnign to the file as comment line,
because it has direct relations
Please help me with these last changes before i try to perform an
overall change.
its almost done!
--
http://mail.python.org/mailman/listinfo/python-list
On 10 Αύγ, 01:43, MRAB wrote:
> Íßêïò wrote:
> > D:\>convert.py
> > File "D:\convert.py", line 34
> > SyntaxError: Non-ASCII character '\xce' in file D:\convert.py on line
> > 34, but no
> > encoding declared; seehttp://www.python.org/peps/pep-0263.htmlfor
> > details
>
> > D:\>
>
> > What does
Νίκος wrote:
D:\>convert.py
File "D:\convert.py", line 34
SyntaxError: Non-ASCII character '\xce' in file D:\convert.py on line
34, but no
encoding declared; see http://www.python.org/peps/pep-0263.html for
details
D:\>
What does it refering too? what character cannot be identified?
Line 34
Νίκος wrote:
On 9 Αύγ, 23:17, MRAB wrote:
Νίκος wrote:
On 9 Αύγ, 21:05, Thomas Jollans wrote:
On Monday 09 August 2010, it occurred to Νίκος to exclaim:
On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote:
Νίκος wrote:
Please tell me that no matter what weird charhs has inside ic an sti
D:\>convert.py
File "D:\convert.py", line 34
SyntaxError: Non-ASCII character '\xce' in file D:\convert.py on line
34, but no
encoding declared; see http://www.python.org/peps/pep-0263.html for
details
D:\>
What does it refering too? what character cannot be identified?
Line 34 is:
src_data
On 9 Αύγ, 23:28, MRAB wrote:
> Íßêïò wrote:
> > On 9 Áýã, 10:07, Íßêïò wrote:
> >> Now the code looks as follows:
>
> >> =
> >> #!/usr/bin/python
>
> >> import re, os, sys
>
> >> id = 0 # unique page_id
>
> >> for currdir, files, dirs in os.walk('test'):
>
> >>
On 9 Αύγ, 23:17, MRAB wrote:
> Νίκος wrote:
> > On 9 Αύγ, 21:05, Thomas Jollans wrote:
> >> On Monday 09 August 2010, it occurred to Νίκος to exclaim:
>
> >>> On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote:
> Νίκος wrote:
> > Please tell me that no matter what weird charhs has ins
Νίκος wrote:
On 9 Αύγ, 10:07, Νίκος wrote:
Now the code looks as follows:
=
#!/usr/bin/python
import re, os, sys
id = 0 # unique page_id
for currdir, files, dirs in os.walk('test'):
for f in files:
if f.endswith('php'):
[snip]
I jus
Νίκος wrote:
On 9 Αύγ, 21:05, Thomas Jollans wrote:
On Monday 09 August 2010, it occurred to Νίκος to exclaim:
On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote:
Νίκος wrote:
Please tell me that no matter what weird charhs has inside ic an still
open thosie fiels and make the neccessary
On 9 Αύγ, 10:07, Νίκος wrote:
> Now the code looks as follows:
>
> =
> #!/usr/bin/python
>
> import re, os, sys
>
> id = 0 # unique page_id
>
> for currdir, files, dirs in os.walk('test'):
>
> for f in files:
>
> if f.endswith('php'):
>
>
On 9 Αύγ, 21:05, Thomas Jollans wrote:
> On Monday 09 August 2010, it occurred to Νίκος to exclaim:
>
>
>
>
>
> > On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote:
> > > Νίκος wrote:
> > > > Please tell me that no matter what weird charhs has inside ic an still
> > > > open thosie fiels and m
On 8 Αύγ, 20:29, John S wrote:
> When replacing text in an HTML document with re.sub, you want to use
> the re.S (singleline) option; otherwise your pattern won't match when
> the opening tag is on one line and the closing is on another.
Thats exactly the problem iam facing now with this stateme
On Monday 09 August 2010, it occurred to Νίκος to exclaim:
> On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote:
> > Νίκος wrote:
> > > Please tell me that no matter what weird charhs has inside ic an still
> > > open thosie fiels and make the neccessary replacements.
> >
> > Go back to 2.6 for
On 9 Αύγ, 19:21, Peter Otten <__pete...@web.de> wrote:
> Νίκος wrote:
> > Please tell me that no matter what weird charhs has inside ic an still
> > open thosie fiels and make the neccessary replacements.
>
> Go back to 2.6 for the moment and defer learning about unicode until you're
> done with th
Νίκος wrote:
> Please tell me that no matter what weird charhs has inside ic an still
> open thosie fiels and make the neccessary replacements.
Go back to 2.6 for the moment and defer learning about unicode until you're
done with the conversion job.
--
http://mail.python.org/mailman/listinfo/py
Please tell me that no matter what weird charhs has inside ic an still
open thosie fiels and make the neccessary replacements.
--
http://mail.python.org/mailman/listinfo/python-list
Νίκος wrote:
On 9 Αύγ, 16:52, MRAB wrote:
Νίκος wrote:
On 8 Αύγ, 17:59, Thomas Jollans wrote:
Two problems here:
str.replace doesn't use regular expressions. You'll have to use the re
module to use regexps. (the re.sub function to be precise)
'.' matches a single character. Any character, b
On 9 Αύγ, 16:52, MRAB wrote:
> Νίκος wrote:
> > On 8 Αύγ, 17:59, Thomas Jollans wrote:
>
> >> Two problems here:
>
> >> str.replace doesn't use regular expressions. You'll have to use the re
> >> module to use regexps. (the re.sub function to be precise)
>
> >> '.' matches a single character. An
On 9 Αύγ, 13:47, Peter Otten <__pete...@web.de> wrote:
> Νίκος wrote:
> > On 9 Αύγ, 13:06, Peter Otten <__pete...@web.de> wrote:
>
> >> > So since its utf-8 what the problem of opening it?
>
> >> Python says it's not, and I tend to believe it.
>
> > You are right!
>
> > I tried to do the same exact
Νίκος wrote:
On 8 Αύγ, 17:59, Thomas Jollans wrote:
Two problems here:
str.replace doesn't use regular expressions. You'll have to use the re
module to use regexps. (the re.sub function to be precise)
'.' matches a single character. Any character, but only one.
'.*' matches as many characte
Νίκος wrote:
> On 9 Αύγ, 13:06, Peter Otten <__pete...@web.de> wrote:
>
>> > So since its utf-8 what the problem of opening it?
>>
>> Python says it's not, and I tend to believe it.
>
> You are right!
>
> I tried to do the same exact openign via IDLE enviroment and i goth
> the encoding of the
On 9 Αύγ, 13:06, Peter Otten <__pete...@web.de> wrote:
> > So since its utf-8 what the problem of opening it?
>
> Python says it's not, and I tend to believe it.
You are right!
I tried to do the same exact openign via IDLE enviroment and i goth
the encoding of the file from there!
>>> open("d:\
Νίκος wrote:
> On 9 Αύγ, 11:45, Peter Otten <__pete...@web.de> wrote:
>> Νίκος wrote:
>> > On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote:
>> >> Νίκος wrote:
>> >> > Now the code looks as follows:
>> >> > for currdir, files, dirs in os.walk('test'):
>>
>> >> > for f in files:
>>
>> >> > if
On 9 Αύγ, 11:45, Peter Otten <__pete...@web.de> wrote:
> Νίκος wrote:
> > On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote:
> >> Νίκος wrote:
> >> > Now the code looks as follows:
> >> > for currdir, files, dirs in os.walk('test'):
>
> >> > for f in files:
>
> >> > if f.endswith('php'):
>
> >>
Νίκος wrote:
> On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote:
>> Νίκος wrote:
>> > Now the code looks as follows:
>> > for currdir, files, dirs in os.walk('test'):
>>
>> > for f in files:
>>
>> > if f.endswith('php'):
>>
>> > # get abs path to filename
>> > src_f = join(currdir, f)
>> > I
On 9 Αύγ, 10:38, Peter Otten <__pete...@web.de> wrote:
> Νίκος wrote:
> > Now the code looks as follows:
> > for currdir, files, dirs in os.walk('test'):
>
> > for f in files:
>
> > if f.endswith('php'):
>
> > # get abs path to filename
> >
Νίκος wrote:
> Now the code looks as follows:
> for currdir, files, dirs in os.walk('test'):
>
> for f in files:
>
> if f.endswith('php'):
>
> # get abs path to filename
> src_f = join(currdir, f)
> I just tried to test i
Now the code looks as follows:
=
#!/usr/bin/python
import re, os, sys
id = 0 # unique page_id
for currdir, files, dirs in os.walk('test'):
for f in files:
if f.endswith('php'):
# get abs path to filename
On 8 Αύγ, 17:59, Thomas Jollans wrote:
> Two problems here:
>
> str.replace doesn't use regular expressions. You'll have to use the re
> module to use regexps. (the re.sub function to be precise)
>
> '.' matches a single character. Any character, but only one.
> '.*' matches as many characters a
� wrote:
Hello dear Pythoneers,
I have over 500 .php web pages in various subfolders under 'data'
folder that i have to rename to .html and and ditch the ''
tages from within and also insert a very first line of
where id must be an identification unique number of every page for
counter tracking
On Aug 8, 10:59 am, Thomas Jollans wrote:
> On 08/08/2010 04:06 PM, Νίκος wrote:
>
>
>
>
>
> > On 8 Αύγ, 15:40, Thomas Jollans wrote:
> >> On 08/08/2010 01:41 PM, Νίκος wrote:
>
> >>> I was so dizzy and confused yesterday that i forgot to metnion that
> >>> not only i need removal of php openign
On 08/08/2010 04:06 PM, Νίκος wrote:
> On 8 Αύγ, 15:40, Thomas Jollans wrote:
>> On 08/08/2010 01:41 PM, Νίκος wrote:
>>
>>> I was so dizzy and confused yesterday that i forgot to metnion that
>>> not only i need removal of php openign and closing tags but whaevers
>>> data lurks inside those tags
On 8 Αύγ, 15:40, Thomas Jollans wrote:
> On 08/08/2010 01:41 PM, Νίκος wrote:
>
> > I was so dizzy and confused yesterday that i forgot to metnion that
> > not only i need removal of php openign and closing tags but whaevers
> > data lurks inside those tags as well ebcause now with the 'counter.py
On 08/08/2010 01:41 PM, Νίκος wrote:
> I was so dizzy and confused yesterday that i forgot to metnion that
> not only i need removal of php openign and closing tags but whaevers
> data lurks inside those tags as well ebcause now with the 'counter.py'
> script i wrote the html fiels would open ftm t
1 - 100 of 297 matches
Mail list logo