Re: Handling Special characters in python

2013-01-02 Thread Chris Rebert
On Wed, Jan 2, 2013 at 5:39 AM, wrote: > On Wednesday, January 2, 2013 12:02:34 PM UTC+5:30, Chris Rebert wrote: >> On Jan 1, 2013 8:48 PM, wrote: >> > On Wednesday, January 2, 2013 12:00:06 AM UTC+5:30, Chris Rebert wrote: >> > > On Jan 1, 2013 3:41 AM, wrote: >> > > > I am facing one issue in

Re: Handling Special characters in python

2013-01-02 Thread anilkumar . dannina
On Wednesday, January 2, 2013 12:02:34 PM UTC+5:30, Chris Rebert wrote: > On Jan 1, 2013 8:48 PM, wrote: > > > On Wednesday, January 2, 2013 12:00:06 AM UTC+5:30, Chris Rebert wrote: > > > > On Jan 1, 2013 3:41 AM, wrote: > > > > > > > > > I am facing one issue in my module. I am gathering da

Re: Handling Special characters in python

2013-01-01 Thread Chris Rebert
On Jan 1, 2013 8:48 PM, wrote: > On Wednesday, January 2, 2013 12:00:06 AM UTC+5:30, Chris Rebert wrote: > > On Jan 1, 2013 3:41 AM, wrote: > > > > > I am facing one issue in my module. I am gathering data from sql server database. In the data that I got from db contains special characters like "

Re: Handling Special characters in python

2013-01-01 Thread anilkumar . dannina
On Wednesday, January 2, 2013 12:00:06 AM UTC+5:30, Chris Rebert wrote: > On Jan 1, 2013 3:41 AM, wrote: > > > > > > I am facing one issue in my module. I am gathering data from sql server > > database. In the data that I got from db contains special characters like > > "endash". Python was ta

Re: Handling Special characters in python

2013-01-01 Thread Chris Rebert
On Jan 1, 2013 3:41 AM, wrote: > > I am facing one issue in my module. I am gathering data from sql server database. In the data that I got from db contains special characters like "endash". Python was taking it as "\x96". I require the same character(endash). How can I perform that. Can you pleas

Re: Handling Special characters in python

2013-01-01 Thread Steven D'Aprano
On Tue, 01 Jan 2013 03:35:56 -0800, anilkumar.dannina wrote: > I am facing one issue in my module. I am gathering data from sql server > database. In the data that I got from db contains special characters > like "endash". Python was taking it as "\x96". I require the same > character(endash). How

Handling Special characters in python

2013-01-01 Thread anilkumar . dannina
I am facing one issue in my module. I am gathering data from sql server database. In the data that I got from db contains special characters like "endash". Python was taking it as "\x96". I require the same character(endash). How can I perform that. Can you please help me in resolving this issue

Re: ignore special characters in python regex

2009-07-21 Thread Gabriel Genellina
En Tue, 21 Jul 2009 02:02:57 -0300, Astan Chee escribió: I'm reading text from a file (per line) and I want to do a regex using these lines but I want the regex to ignore any special characters and treat them like normal strings. Is there a regex function that can do this? Here is what I

Re: ignore special characters in python regex

2009-07-21 Thread Astan Chee
I think the re.escape did the trick. to answer your questions: By "ignore" i meant instead of using non-alphanumeric characters that have special significance in regular expression (e.g. [|\]) and treat them as normal strings (i.e preceded by \), but since I don't know all the characters in reg

Re: ignore special characters in python regex

2009-07-20 Thread John Machin
On Jul 21, 3:02 pm, Astan Chee wrote: > Hi, > I'm reading text from a file (per line) and I want to do a regex using > these lines but I want the regex to ignore any special characters and > treat them like normal strings. > Is there a regex function that can do this? It would help if you were to

Re: ignore special characters in python regex

2009-07-20 Thread Frank Buss
Astan Chee wrote: > I'm reading text from a file (per line) and I want to do a regex using > these lines but I want the regex to ignore any special characters and > treat them like normal strings. > Is there a regex function that can do this? Maybe re.escape helps? -- Frank Buss, f...@frank-b

ignore special characters in python regex

2009-07-20 Thread Astan Chee
Hi, I'm reading text from a file (per line) and I want to do a regex using these lines but I want the regex to ignore any special characters and treat them like normal strings. Is there a regex function that can do this? Here is what I have so far: fp = open('file.txt','r') notes = fp.readlines

Re: unable to print Unicode characters in Python 3

2009-01-28 Thread Ross Ridge
John Machin writes: > The only font choice offered apart from "Raster Fonts" in the Command > Prompt window's Properties box is "Lucida Console", not "Lucida Sans > Unicode". It will let me print Cyrillic characters from a C program, > but not Chinese. I'm off looking for how to get a better font.

Re: unable to print Unicode characters in Python 3

2009-01-28 Thread Martin v. Löwis
> Big step. I don't have Visual Studio and have never used it before. > Which version of VS do I need to debug which released version of Python > 2.X and where do I get that VS from? Or do I need to build Python from > source to be able to debug it? You need Visual Studio 2008 (Professional, not s

Re: unable to print Unicode characters in Python 3

2009-01-28 Thread jefm
this is alink explaining how to add new fonts to the command line (e.g. Lucida Sans Unicode) http://phatness.com/node/1643 -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to print Unicode characters in Python 3

2009-01-28 Thread Thorsten Kampe
* John Machin (Tue, 27 Jan 2009 18:03:55 -0800 (PST)) > On Jan 28, 5:56 am, "Martin v. Löwis" wrote: > The only font choice offered apart from "Raster Fonts" in the Command > Prompt window's Properties box is "Lucida Console", not "Lucida Sans > Unicode". It will let me print Cyrillic characters f

Re: unable to print Unicode characters in Python 3

2009-01-28 Thread John Machin
On 28/01/2009 6:32 PM, Martin v. Löwis wrote: Next step? You need to use the Visual Studio debugger to find out where precisely the IOError comes from. Big step. I don't have Visual Studio and have never used it before. Which version of VS do I need to debug which released version of Python

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Martin v. Löwis
> Next step? You need to use the Visual Studio debugger to find out where precisely the IOError comes from. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Benjamin Kaplan
On Tue, Jan 27, 2009 at 9:16 PM, Gabriel Genellina wrote: > En Wed, 28 Jan 2009 00:03:55 -0200, John Machin > escribió: > > On Jan 28, 5:56 am, "Martin v. Löwis" wrote: >> >>> > #include "stdio.h" >>> > int main(int argc, char **argv) { >>> > printf("<\xc2\x80>\n"); >>> > } >>> >>> > co

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Gabriel Genellina
En Wed, 28 Jan 2009 00:03:55 -0200, John Machin escribió: On Jan 28, 5:56 am, "Martin v. Löwis" wrote: > #include "stdio.h" > int main(int argc, char **argv) { >     printf("<\xc2\x80>\n"); >     } > compiled with mingw32 (gcc (GCC) 3.4.5 (mingw-vista special r3)) > and using "Lucida Console

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread John Machin
On Jan 28, 5:56 am, "Martin v. Löwis" wrote: > > #include "stdio.h" > > int main(int argc, char **argv) { > >     printf("<\xc2\x80>\n"); > >     } > > > compiled with mingw32 (gcc (GCC) 3.4.5 (mingw-vista special r3)) > > and using "Lucida Console" font: > > > After CHCP 1252, this prints < A-cir

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Benjamin Kaplan
On Tue, Jan 27, 2009 at 7:41 PM, John Machin wrote: > On Jan 27, 6:17 pm, "Martin v. Löwis" wrote: > > > Well, the first step would be to tell Python that there is a code page > > > 65001. On Python 2.6, I get a LookupError for an unknown encoding after > > > doing "chcp 65001". I checked the li

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread John Machin
On Jan 27, 6:17 pm, "Martin v. Löwis" wrote: > > Well, the first step would be to tell Python that there is a code page > > 65001. On Python 2.6, I get a LookupError for an unknown encoding after > > doing "chcp 65001". I checked the list of aliases in Python 3 and there > > was no entry for cp650

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Martin v. Löwis
> #include "stdio.h" > int main(int argc, char **argv) { > printf("<\xc2\x80>\n"); > } > > compiled with mingw32 (gcc (GCC) 3.4.5 (mingw-vista special r3)) > and using "Lucida Console" font: > > After CHCP 1252, this prints < A-circumflex Euro >, as expected. > After CHCP 65001, it prints

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Denis Kasak
On Tue, Jan 27, 2009 at 7:08 PM, Thorsten Kampe wrote: > * Denis Kasak (Tue, 27 Jan 2009 14:22:32 +0100) >> On Tue, Jan 27, 2009 at 1:52 PM, Giampaolo Rodola' >> wrote: >> print unicode('\u20ac') >> > \u20ac >> >> Shouldn't this be >> >> print unicode(u'\u20ac') > > You are trying to crea

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Thorsten Kampe
* Denis Kasak (Tue, 27 Jan 2009 14:22:32 +0100) > On Tue, Jan 27, 2009 at 1:52 PM, Giampaolo Rodola' > wrote: > > I have this same issue on Windows. > > Note that on Python 2.6 it works: > > > > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit > > (Intel)] on > > win32 > > Type

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Thorsten Kampe
* Giampaolo Rodola' (Tue, 27 Jan 2009 04:52:16 -0800 (PST)) > I have this same issue on Windows. > Note that on Python 2.6 it works: > > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread John Machin
On Jan 27, 11:52 pm, "Giampaolo Rodola'" wrote: > On 26 Gen, 19:16, jefm wrote: > > > > > Hi, > > while checking out Python 3, I read that all text strings are now > > natively Unicode. > > In the Python language reference (http://docs.python.org/3.0/reference/ > > lexical_analysis.html) I read t

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Stephen Hansen
> > Note that on Python 2.6 it works: > > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> print unicode('\u20ac') > \u20ac > Note that in Python 2.6 it expressly *does not* work

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Denis Kasak
On Tue, Jan 27, 2009 at 1:52 PM, Giampaolo Rodola' wrote: > I have this same issue on Windows. > Note that on Python 2.6 it works: > > Python 2.6.1 (r261:67517, Dec 4 2008, 16:51:00) [MSC v.1500 32 bit > (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information.

Re: unable to print Unicode characters in Python 3

2009-01-27 Thread Giampaolo Rodola'
On 26 Gen, 19:16, jefm wrote: > Hi, > while checking out Python 3, I read that all text strings are now > natively Unicode. > In the Python language reference (http://docs.python.org/3.0/reference/ > lexical_analysis.html) I read that I can show Unicode character in > several ways. > "\u" supp

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin v. Löwis
> Well, the first step would be to tell Python that there is a code page > 65001. On Python 2.6, I get a LookupError for an unknown encoding after > doing "chcp 65001". I checked the list of aliases in Python 3 and there > was no entry for cp65001. I see. What happens if you add it to encoding/ali

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Benjamin Kaplan
On Mon, Jan 26, 2009 at 5:42 PM, "Martin v. Löwis" wrote: > > I was hoping to find something that allows me to print any Unicode > > character on the console. > > You will have to debug the Python interpreter to find out what's > going wrong in code page 65001. Nobody has ever resolved that myster

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread John Machin
On Jan 27, 9:42 am, "Martin v. Löwis" wrote: > > I was hoping to find something that allows me to print any Unicode > > character on the console. > > You will have to debug the Python interpreter to find out what's > going wrong in code page 65001. Nobody has ever resolved that mystery, > although

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread John Machin
On Jan 27, 10:00 am, "Martin v. Löwis" wrote: > > IOW, the bridge might think it's in cp1252 mode, but nobody told the > > engine room, which is still churning out cp850. > > I think you must use a different font in the console, too, such as > Lucida Sans Unicode. True. I was just about to post t

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin v. Löwis
> IOW, the bridge might think it's in cp1252 mode, but nobody told the > engine room, which is still churning out cp850. I think you must use a different font in the console, too, such as Lucida Sans Unicode. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin v. Löwis
> I was hoping to find something that allows me to print any Unicode > character on the console. You will have to debug the Python interpreter to find out what's going wrong in code page 65001. Nobody has ever resolved that mystery, although it's been known for some time. If you merely want to se

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread John Machin
On Jan 27, 8:38 am, Jean-Paul Calderone wrote: > On Mon, 26 Jan 2009 13:26:56 -0800 (PST), jefm > wrote: > >>As Benjamin Kaplin said, Windows terminals use the old cp1252 character > >>set, which cannot display the euro sign. You'll either have to run it in > >> something more modern like the cy

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
chcp 1252 does allow me to print the EURO sign. Thanks for pointing that out. However, it does not show me some ALL Unicode characters. Very frustrating. I was hoping to find something that allows me to print any Unicode character on the console. -- http://mail.python.org/mailman/listinfo/python-li

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
Now that I know the problem, I found the following on Google. Windows uses codepages to display different character sets. (http:// en.wikipedia.org/wiki/Code_page) The Windows chcp command allows you to change the character set from the original 437 set. When you type on the command line: chcp

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Jean-Paul Calderone
On Mon, 26 Jan 2009 13:26:56 -0800 (PST), jefm wrote: As Benjamin Kaplin said, Windows terminals use the old cp1252 character set, which cannot display the euro sign. You'll either have to run it in something more modern like the cygwin rxvt terminal, or output some other way, such as through a

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
>As Benjamin Kaplin said, Windows terminals use the old cp1252 character >set, which cannot display the euro sign. You'll either have to run it in > something more modern like the cygwin rxvt terminal, or output some >other way, such as through a GUI. >With the standard console, I get the same. B

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Terry Reedy
jefm wrote: Hi, while checking out Python 3, I read that all text strings are now natively Unicode. True In the Python language reference (http://docs.python.org/3.0/reference/ lexical_analysis.html) I read that I can show Unicode character in several ways. "\u" supposedly allows me to sp

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Michael Torrie
jefm wrote: >> Hmm this works for me, >> it's a self compiled version: >> ~ $ python3 >> Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) >> [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 > > You are running on Linux. Mine is on Windows. > Anyone else have this issue on Windows ? As Benjamin Kaplin

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
>Hmm this works for me, >it's a self compiled version: >~ $ python3 >Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) >[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 You are running on Linux. Mine is on Windows. Anyone else have this issue on Windows ? -- http://mail.python.org/mailman/listinfo/pytho

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Benjamin Kaplan
On Mon, Jan 26, 2009 at 1:16 PM, jefm wrote: > Hi, > while checking out Python 3, I read that all text strings are now > natively Unicode. > In the Python language reference (http://docs.python.org/3.0/reference/ > lexical_analysis.html)

Re: unable to print Unicode characters in Python 3

2009-01-26 Thread Martin
Hmm this works for me, it's a self compiled version: ~ $ python3 Python 3.0 (r30:67503, Dec 29 2008, 21:35:15) [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> print("\u20ac") € >>> print ("\N{EURO SIGN}") € >>> 2009/1/26 j

unable to print Unicode characters in Python 3

2009-01-26 Thread jefm
Hi, while checking out Python 3, I read that all text strings are now natively Unicode. In the Python language reference (http://docs.python.org/3.0/reference/ lexical_analysis.html) I read that I can show Unicode character in several ways. "\u" supposedly allows me to specify the Unicode chara

Re: interpretation of special characters in Python

2008-07-07 Thread TP
Peter Pearson wrote: > I don't understand exactly what you mean by "Sorry" I means: please forgive me for having said that it does not work with variables, because it is completely false. Thanks one more time Julien -- TP (Tribulations Parallèles) "Allez, Monsieur, allez, et la foi vous vien

Re: interpretation of special characters in Python

2008-07-07 Thread Peter Pearson
On Mon, 07 Jul 2008 10:05:56 +0200, TP <[EMAIL PROTECTED]> wrote: > TP wrote: > >> So, the python print command *can* interpret these 4-character as a single >> character. It would be odd if there were no possibility to do the same >> thing when the characters are (i) stored in a python variable >

Re: interpretation of special characters in Python

2008-07-07 Thread TP
Peter Otten wrote: esc = os.environ["esc"].decode("string-escape") esc > '\x1b' print "%s[30;44malles so schoen bunt hier%s[0m" % (esc, esc) > alles so schoen bunt hier Thanks a lot for your help. It works perfectly. Indeed, one can read in the documentation concerning encodings:

Re: interpretation of special characters in Python

2008-07-07 Thread Peter Otten
Peter Pearson wrote: > On Sun, 06 Jul 2008 23:42:26 +0200, TP <[EMAIL PROTECTED]> > wrote: >> >> $ python -c "print '\033[30;44m foo \033[0m'" > [writes an escape sequence to stdout] > >> $ echo -e $esc$ColorBlackOnDarkblue foo $esc$ColorReset > [also writes an escape sequence to stdout] > >> $

Re: interpretation of special characters in Python

2008-07-07 Thread TP
TP wrote: > So, the python print command *can* interpret these 4-character as a single > character. It would be odd if there were no possibility to do the same > thing when the characters are (i) stored in a python variable Sorry, it works when using variables. Try for example: col="[0;31m" esc=

Re: interpretation of special characters in Python

2008-07-07 Thread Ben Finney
TP <[EMAIL PROTECTED]> writes: > Peter Pearson wrote: > > > When you tell python "print '\033[30;44m foo \033[0m'", python > > interprets the "\033" as a single character. > > So, the python print command *can* interpret these 4-character as a > single character. Not "interpret", no. It's more

Re: interpretation of special characters in Python

2008-07-06 Thread TP
Peter Pearson wrote: Thanks for your answer. > When you run echo, it recognizes the 4-character "esc" as a > convention for representing a single character, and performs > the re-interpretation for you. When you tell python > "print '\033[30;44m foo \033[0m'", python interprets > the "\033" as a

Re: interpretation of special characters in Python

2008-07-06 Thread TP
Dennis Lee Bieber wrote: > Off-hand, I'd probably try first with: > > csi = "\033[" > > and then define your > > colorblackondarkblue = $csi"30;44m" Thanks for your answer. I have tried this slight modification, but it does not change anything on my terminal. -- TP (Tribulations Parallèles)

Re: interpretation of special characters in Python

2008-07-06 Thread Peter Pearson
On Sun, 06 Jul 2008 23:42:26 +0200, TP <[EMAIL PROTECTED]> wrote: > > $ python -c "print '\033[30;44m foo \033[0m'" [writes an escape sequence to stdout] > $ echo -e $esc$ColorBlackOnDarkblue foo $esc$ColorReset [also writes an escape sequence to stdout] > $ echo -n $esc$ColorBlackOnDarkblue foo

interpretation of special characters in Python

2008-07-06 Thread TP
Hi everybody, I am new to Python, I try to understand how Python treats special characters. For example, if I execute the following line in a shell console, I obtain a colored string: $ python -c "print '\033[30;44m foo \033[0m'" So, it works. Some time ago, I have made a lot of shell variables

Re: 2 new comment-like characters in Python to aid development?

2007-03-11 Thread Paddy
On Mar 9, 10:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > What if 2 new 'special' comment-like characters were added to Python?: > > > 1. The WIP (Work In Progress) comment: > > I use # FIXME for this purpose or /* FIXME */ in C etc. > > I h

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > But # is 'only a comment sign' as well, and equally meaningless to > the interpreter. No! "#" means "disregard everything until EOL" to the interpreter. Your proposed highlighting character means exactly nothing to the interpreter. Get the difference? > But it's still

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Robert Marshall
On 09 Mar 2007, Matthew Woodcraft wrote: > Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > Nick Craig-Wood a ecrit : >> I use # FIXME for this purpose or /* FIXME */ in C etc. >> >> I have an emacs macro which shows it up in bright red / yellow >> text so it is easy to see >

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Matthew Woodcraft
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: Nick Craig-Wood a ecrit : > I use # FIXME for this purpose or /* FIXME */ in C etc. > > I have an emacs macro which shows it up in bright red / yellow text > so it is easy to see > Thanks you both. For what it's worth, sufficien

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Diez B. Roggisch
>> The ? has no meaning. It only has a meaning for an editor. > > So it _does_ have meaning! I'm sorry I just don't buy into this kind > of abstract programming ideology, and I never really have. I don't > care what the interpreter finds meaningful and neither, on a day to > day basis, do most us

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
> But all of them are clear on how they work: they affect one line, or have a > bracket style like /* */ and thus demark clearly what they affect. Even > someone not fluent in the language in question will quickly grab what they > mean. There's nothing remotely fuzzy about how wip or halt comments

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bruno Desthuilliers
Nick Craig-Wood a écrit : > Robert Marshall <[EMAIL PROTECTED]> wrote: >> On Fri, 09 Mar 2007, Bruno Desthuilliers wrote: >> >>> Nick Craig-Wood a ?crit : [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What if 2 new 'special' comment-like characters were added to > Python?: > >>

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: >> > I'm sorry I don't follow your logic. Meaningless to the interpreter, >> > yes, meaningless to the IDE or to me, no. I "_can't_ profit from these >> > conveniences"? Why ever not? >> >> Exactly, the ? is meaningless to the language itself, it's only a comment >> sign -

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
> > I'm sorry I don't follow your logic. Meaningless to the interpreter, > > yes, meaningless to the IDE or to me, no. I "_can't_ profit from these > > conveniences"? Why ever not? > > Exactly, the ? is meaningless to the language itself, it's only a comment > sign - ... > ... it has nothing to do

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > On 9 Mar, 14:05, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> But you _can't_ profit from these conveniences, at least not the ? >> character. It's just garbage put in there for some others to interpret, >> meaningless to the interpreter. So it _always_ boils down to

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
On 9 Mar, 14:05, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > But you _can't_ profit from these conveniences, at least not the ? > character. It's just garbage put in there for some others to interpret, > meaningless to the interpreter. So it _always_ boils down to > editor-support. I'm sorry I

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Diez B. Roggisch
> It sounds like other Python users *do* like to do the kind of things I > suggested, but seasoned users would rather rely on macros and features > of specific editors. Unfortunately, to a newbie like myself, these > seem like obscure 'tricks' to be mastered rather than simple built-in > convenienc

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
> Yes, it has. It says "disregard the following characters until EOL". > If you remove it, the following code will be interpreted as ... > code (and not be disregarded). and ! would say "disregard the following characters until End Of Program". Is it really so different? > > Well I'm not a big f

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Nick Craig-Wood
Robert Marshall <[EMAIL PROTECTED]> wrote: > On Fri, 09 Mar 2007, Bruno Desthuilliers wrote: > > > > > Nick Craig-Wood a ?crit : > >> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > >>> What if 2 new 'special' comment-like characters were added to > >>> Python?: > >>> > >>> > >>> 1. The WIP (W

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: >> Those characters have no syntactical meaning... > > ? > Neither does # until you give it syntactical meaning. I must be > missing what you mean. Yes, it has. It says "disregard the following characters until EOL". If you remove it, the following code will be interprete

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Robert Marshall
On Fri, 09 Mar 2007, Bruno Desthuilliers wrote: > > Nick Craig-Wood a écrit : >> [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >>> What if 2 new 'special' comment-like characters were added to >>> Python?: >>> >>> >>> 1. The WIP (Work In Progress) comment: >> >> I use # FIXME for this purpose o

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
On Mar 9, 10:59 am, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: > On 9 Mar 2007 02:31:14 -0800, [EMAIL PROTECTED] > > > > > > <[EMAIL PROTECTED]> wrote: > > Thanks for the thoughts. > > > > This could be implemented without new syntax: just make your editor > > > recognize some special comments, a

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Diez B. Roggisch
> > Well I'm not a big fan of decorators so I know how you must feel. But > # FIXME + a hack doesn't seem clean to me. And commenting off the > bottom half of a long script with triple quotes is ugly and a pain and > you can't indicate multiple alternate halt points as in the 'tutorial > script' e

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
>Those characters have no syntactical meaning... ? Neither does # until you give it syntactical meaning. I must be missing what you mean. > would, IMHO, make the language "dirty". Well I'm not a big fan of decorators so I know how you must feel. But # FIXME + a hack doesn't seem clean to me. And

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread BJörn Lindqvist
On 9 Mar 2007 02:31:14 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Thanks for the thoughts. > > > This could be implemented without new syntax: just make your editor > > recognize some special comments, and apply the highlighting to the > > following block. By example, > > > >

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Of course I'll still argue that the WIP character would be a more > elegant, speedy and versatile alternative. I don't think so. Those characters have no syntactical meaning and would, IMHO, make the language "dirty". Regards, Björn -- BOFH excuse #73: Daemons did

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Bruno Desthuilliers
Nick Craig-Wood a écrit : > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> What if 2 new 'special' comment-like characters were added to Python?: >> >> >> 1. The WIP (Work In Progress) comment: > > I use # FIXME for this purpose or /* FIXME */ in C etc. > > I have an emacs macro which shows it

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
Thanks for the thoughts. > This could be implemented without new syntax: just make your editor > recognize some special comments, and apply the highlighting to the > following block. By example, > > # XXX Remove this when FuruFaifa is fixed to always provide > #

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Nick Craig-Wood
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > What if 2 new 'special' comment-like characters were added to Python?: > > > 1. The WIP (Work In Progress) comment: I use # FIXME for this purpose or /* FIXME */ in C etc. I have an emacs macro which shows it up in bright red / yellow text so it

Re: 2 new comment-like characters in Python to aid development?

2007-03-09 Thread Gabriel Genellina
En Fri, 09 Mar 2007 06:14:46 -0300, <[EMAIL PROTECTED]> escribió: > A '?' placed in the preceding whitespace of a line as a means of > quickly highlighting a line or block of code for special attention. > The interpreter simply ignores these characters, and executes the code > as if each WIP chara

2 new comment-like characters in Python to aid development?

2007-03-09 Thread dbhbarton
Had a thought that's grown on me. No idea if it's original or not- too inexperienced in programming- but I guess there's no harm floating it out there. Python wins big on readability, and there's no doubt that context- dependent text formatting in IDEs (keywords, strings, comments etc) is a massiv

Re: how to store and still search special characters in Python and MySql

2007-02-15 Thread Justin Ezequiel
On Feb 12, 12:26 pm, "ronrsr" <[EMAIL PROTECTED]> wrote: > I have an MySQL database called zingers. The structure is: > > I am having trouble storing text, as typed in latter two fields. > Special characters and punctuation all seem not to be stored and > retrieved correctly. > > Special apostroph

how to store and still search special characters in Python and MySql

2007-02-11 Thread ronrsr
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text I am having trouble storing text, as typed in latter two fields. Special characters and punctuation all seem not to be stored and retrieved correctly. S

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Leo Kislov
ronrsr wrote: > > > > > Try putting "use_unicode=True" in the MySQLdb "connect" call. > > tried that, and also added charset="utf8" - > > now, I can't do any string operations, I get the error msg: > > descriptor 'lower' requires a 'str' object but received a 'unicode' > args = ("descript

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Fredrik Lundh
ronrsr wrote: > querystring = "update zingers set keywords = '%s', citation = > '%s', quotation = %s' where zid = %d" % > (keywords,citation,quotation,zid) that's not a good way to pass strings to the database. for the right way to do this, see: http://effbot.org/pyfaq/how-do-i-e

Re: dealing with special characters in Python and MySQL

2006-12-18 Thread Fredrik Lundh
ronrsr wrote: > now, I can't do any string operations, I get the error msg: > > descriptor 'lower' requires a 'str' object but received a 'unicode' > args = ("descriptor 'lower' requires a 'str' object but received > a 'unicode'",) what's a "string operation" in this context? are you tryi

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
> > > Try putting "use_unicode=True" in the MySQLdb "connect" call. tried that, and also added charset="utf8" - now, I can't do any string operations, I get the error msg: descriptor 'lower' requires a 'str' object but received a 'unicode' args = ("descriptor 'lower' requires a 'str'

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread fumanchu
ronrsr wrote: > code for storing to database: > > querystring = "update zingers set keywords = '%s', citation = > '%s', quotation = %s' where zid = %d" % > (keywords,citation,quotation,zid) You're missing a single quote in there around the quotation %s. Are you also replacing "\\" w

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
version of python is either 2.2 or 2.4 bests, -rsr- John Nagle wrote: > ronrsr wrote: -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
version of python is 2.2 - -- http://mail.python.org/mailman/listinfo/python-list

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread John Nagle
ronrsr wrote: >>are you passing in the strings as Unicode strings, or as something else? >> if you're using something else, what have you done to tell the >>database what it is? >> > > > > not at all sure what I'm passing it as. > > The database default encoding is utf-8 > the database collat

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
> > are you passing in the strings as Unicode strings, or as something else? > if you're using something else, what have you done to tell the > database what it is? > not at all sure what I'm passing it as. The database default encoding is utf-8 the database collation is utf-8 the page encod

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
structure for the DB: CREATE TABLE `zingers` ( `zid` int(9) unsigned NOT NULL auto_increment, `keywords` varchar(255) default NULL, `citation` text, `quotation` text, PRIMARY KEY (`zid`) ) ENGINE=MyISAM DEFAULT CHARSET=UTF8 AUTO_INCREMENT=422 ; code for stor

Re: dealing with special characters in Python and MySQL

2006-12-17 Thread Fredrik Lundh
ronrsr wrote: > I have an MySQL database called zingers. The structure is: > > zid - integer, key, autoincrement > keyword - varchar > citation - text > quotation - text > > the encoding and collation is utf-8 > > I am having trouble storing text, as typed in last two fields. S

dealing with special characters in Python and MySQL

2006-12-17 Thread ronrsr
I have an MySQL database called zingers. The structure is: zid - integer, key, autoincrement keyword - varchar citation - text quotation - text the encoding and collation is utf-8 I am having trouble storing text, as typed in last two fields. Special characters and punctuation

Re: characters in python

2006-10-19 Thread Gigs_
Leo Kislov wrote: > > On Oct 18, 11:50 am, Stens <[EMAIL PROTECTED]> wrote: >> Stens wrote: >>> Can python handle this characters: c,c,ž,d,š? >>> If can how"I wanna to change some characters in text (in the file) to the >> characters at this address: >> >> http://rapidshare.de/files/37244252/Untit

Re: characters in python

2006-10-19 Thread Gigs_
I solve it. Just have to do another encoding: http://www.python.org/dev/peps/pep-0263/ -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >